Да си вземем стейта?
defmodule StateServerA do
use GenServer
def start_link(initial_state, opts \\ []) do
name = Keyword.get(opts, :name, __MODULE__)
GenServer.start_link(__MODULE__, initial_state, name: name)
end
@impl GenServer
def init(init_arg), do: {:ok, init_arg}
@impl GenServer
def handle_call(:get, from, state) do
IO.inspect(from)
{:reply, state, state}
end
end
{:ok, pid} = StateServerA.start_link(%{})
GenServer.call(pid, :get)