View Source Exrpc (exrpc v0.4.2)
Lean Elixir RPC library based on RESP (REdis Serialization Protocol).
To set up, start Exrpc.Server
on the server side and Exrpc.Client
on the client side.
Server-side
# module with function to be called remotely
defmodule ServerSideModule do
def hello(name), do: "Hello " <> name
end
# start link or add child spec to your supervisor
Exrpc.Server.start_link(name: HelloRpc, port: 7379, mfa_list: [&ServerSideModule.hello/1])
Client-side
# start link or add child spec to your supervisor
Exrpc.Client.start_link(name: HelloRpc, host: "localhost", port: 7379)
# make a remote function call:
Exrpc.call(HelloRpc, ServerSideModule, :hello, ["world"])
Summary
Types
Functions
Calls a remote function.
Example
iex> Exrpc.call(:my_client, ServerSideModule, :hello, ["world"])
"Hello world"
@spec mfa_list(Exrpc.Client.t()) :: [mfa()]
List available remote functions.
Example
iex> Exrpc.mfa_list(:my_client)
[{ServerSideModule, :hello, 1}]