testing channels

This commit is contained in:
2026-03-03 09:46:12 -07:00
parent c86fbe9f67
commit e0f2d8c4aa
9 changed files with 285 additions and 5 deletions

View File

@@ -46,6 +46,10 @@ defmodule Backend.GameRunner do
GenServer.call(@name, :get_state)
end
def get_node_name do
GenServer.call(@name, :get_node_name)
end
# Server Callbacks
@impl true
@@ -137,6 +141,11 @@ defmodule Backend.GameRunner do
{:reply, state, state}
end
@impl true
def handle_call(:get_node_name, _from, state) do
{:reply, node(), state}
end
defp broadcast_state(state) do
Phoenix.PubSub.broadcast(Backend.PubSub, "game_state", {:game_state_updated, state})
state