Mooncore.Endpoint.Socket.Handler
(mooncore v0.2.5)
Copy Markdown
WebSocket connection handler.
Manages WebSocket connections: authentication, channel subscriptions, message routing, and binary protocol support.
Connection Flow
- Client connects to
/ws— upgrade via WebSockAdapter - Handler.init/1 — sets up state, subscribes to user channels if authed
- Client sends messages — text (JSON) or binary (metadata + payload)
- Handler routes to action pipeline or handles control messages
Special Messages
"ping"→"pong""time"→ server timestamp"channel_list"→ list of subscribed channels"quit"→ close connection["jwt", token]→ authenticate and subscribe to channels["join", channel]→ subscribe to channel (requires role)["leave", channel]→ unsubscribe from channel- Any JSON object with
"action"key → dispatched to action pipeline