Skip to main content

Module broadcasting

Module broadcasting 

Source
Expand description

The half of broadcasting that needs HTTP: the authorisation endpoint, the socket header, and the notification channel.

rainier-broadcast depends on support and nothing else, so it can be used from a worker with no router. What lives here is what genuinely needs a request: /broadcasting/auth, which is how a browser proves to your WebSocket server that it may subscribe to a private channel.

browser ──subscribe private-orders.7──▶ soketi
   │                                      │
   └──POST /broadcasting/auth─────────────┘  "prove it"
         ▲
         └── this module: is this user allowed, and here is the signature

Structs§

BroadcastChannel
Sends notifications to a private channel for the recipient.

Constants§

SOCKET_ID_HEADER
The header a Pusher client sends its socket id in.

Functions§

authorize
POST /broadcasting/auth — decide whether this user may subscribe.
authorize_notifications
Register the notification channel’s authoriser.
bind_defaults
Bind broadcasting into app with the log driver and an empty channel table.
socket_id
The socket id this request came from, if the client sent one.