For some reason i’m getting this error:
[error] GenServer KioskTracker_shard10 terminating
** (stop) exited in: GenServer.call(KioskTracker_shard10, {:list, “room:kiosk”}, 5000)
** (EXIT) process attempted to call itself
It’s erroring out on the Phoenix.Tracker.list call.
What is the proper way to access the list of tracked connections within the handle_diff callback function of a Phoenix Tracker?
Thanks!
def handle_diff(diff, state) do
kiosks = Phoenix.Tracker.list(__MODULE__, "room:kiosk")
IO.puts("KIOSKS CONNECTED")
IO.inspect(kiosks)
for {topic, {joins, leaves}} <- diff do
for {key, meta} <- joins do
IO.puts("presence join: key \"#{key}\" with meta #{inspect(meta)}")
# This stuff might be for distributed system with more than one node, look into it later
# msg = {:join, key, meta}
# Phoenix.PubSub.direct_broadcast!(state.node_name, state.pubsub_server, topic, msg)
end
for {key, meta} <- leaves do
IO.puts("presence leave: key \"#{key}\" with meta #{inspect(meta)}")
# This stuff might be for distributed system with more than one node, look into it later
# msg = {:leave, key, meta}
# Phoenix.PubSub.direct_broadcast!(state.node_name, state.pubsub_server, topic, msg)
end
end
{:ok, state}
end
Blockquote