feat(server): agent socket endpoint, clear online status on boot

This commit is contained in:
Carsten 2026-04-21 22:03:03 +02:00
parent b141ee7816
commit d9a52db4ea
3 changed files with 19 additions and 1 deletions

View file

@ -0,0 +1,12 @@
defmodule ServerWeb.AgentSocket do
@moduledoc "Entry socket for agents. Actual authentication happens in HostChannel.join/3."
use Phoenix.Socket
channel "host:*", ServerWeb.HostChannel
@impl true
def connect(_params, socket, _connect_info), do: {:ok, socket}
@impl true
def id(_socket), do: nil
end

View file

@ -15,6 +15,10 @@ defmodule ServerWeb.Endpoint do
websocket: [connect_info: [session: @session_options]],
longpoll: [connect_info: [session: @session_options]]
socket "/socket", ServerWeb.AgentSocket,
websocket: [timeout: 45_000],
longpoll: false
# Serve at "/" the static files from "priv/static" directory.
#
# You should set gzip to true if you are running phx.digest