Mooncore.Endpoint.Socket
(mooncore v0.2.5)
Copy Markdown
WebSocket pub/sub and message handling.
Provides publish/3 for broadcasting to connected clients
and receive/2 for processing incoming WebSocket messages through the action pipeline.
Summary
Functions
Publish a message to all clients in the given channels.
Handle an incoming WebSocket message through the action pipeline. Builds a request map from the socket state and message, executes the action, and pushes the response back to the client.
Functions
Publish a message to all clients in the given channels.
Examples
# Broadcast to default channel
Mooncore.Endpoint.Socket.publish("domain_key", {"record", data})
# Broadcast to specific channels
Mooncore.Endpoint.Socket.publish("domain_key", {"event", data}, ["main:default", "main:branch1"])
Handle an incoming WebSocket message through the action pipeline. Builds a request map from the socket state and message, executes the action, and pushes the response back to the client.