radion.realtime is the WebSocket client. It runs the whole connection for you. It connects, reconnects after an unexpected drop, puts your subscriptions back, and sends each incoming frame to the handlers you set up.
Connect
connect() opens the socket and finishes once the connection is up. If the first try fails, it errors.
subscribe before or after connect. Either way, the client sends your subscriptions once the socket is open.
Lifecycle
- Connect —
connect()opens the socket with yourX-API-Keyheader. - Subscribe — add your subscriptions. The client sends them on open and again on every reconnect.
- Receive — channel events go to your handlers. Lifecycle events tell you the connection state.
- Close —
close()shuts down cleanly and stops all reconnect tries.
Reference
Subscriptions
Subscribe with ids and filters.
Events
Channel, wildcard, and lifecycle handlers.
Reconnect & heartbeats
Backoff, keep-alive, and resubscribe.
Errors
The error hierarchy and server codes.