View Source Exrpc (exrpc v0.3.6)

Simple Elixir RPC without Erlang distribution.

To set up, you need to start Exrpc.Server on the server side and Exrpc.Client on the client side.

Start Exrpc.Server with a list of modules and functions you want to expose:

defmodule ServerSideModule do
  def hello(name), do: "Hello " <> name
end

# start link or add child spec to your supervisor
Exrpc.Server.start_link(name: :my_server, port: 5670, mfa_list: [&ServerSideModule.hello/1])

Start Exrpc.Client with the address of the server:

# start link or add child spec to your supervisor
Exrpc.Client.start_link(name: :my_client, host: "localhost", port: 5670)

Summary

Functions

List available remote functions.

Functions

Link to this function

call(client, mod, fun, args, timeout \\ :infinity)

View Source
@spec call(Exrpc.Client.t(), module(), atom(), list(), timeout()) ::
  {:badrpc, atom()} | {:badrpc, atom(), binary()} | any()

Calls a remote function.

iex> Exrpc.call(:my_client, ServerSideModule, :hello, ["world"])
"Hello world"
@spec mfa_list(Exrpc.Client.t()) :: [mfa()]

List available remote functions.

iex> Exrpc.mfa_list(:my_client)
[{ServerSideModule, :hello, 1}]