Standard Channels
Standard channels allow an unlimited number of subscribers to receive and exchange messages in real time. This is the default channel type and covers the majority of use cases — live dashboards, notifications, collaborative editing, IoT telemetry, and anything else where clients need real-time data but don't need awareness of one another.
For channels where subscribers need to know who else is connected, use presence channels.
Subscribe
Once connected to the WebSocket with a token authorizing subscribe on a channel, subscribe by sending a hotsock.subscribe message:
> {"event":"hotsock.subscribe", "channel":"live-updates"}
You'll receive a hotsock.subscribed confirmation:
{
"event": "hotsock.subscribed",
"channel": "live-updates",
"data": {},
"meta": { "uid": null, "umd": null }
}
From this point on, any messages published to this channel (by your backend or by other clients) are delivered to this connection:
{
"id": "01J66BCPSDHYZQ38BW5M357YX5",
"event": "ticker-values",
"channel": "live-updates",
"data": { "AAPL": "226.84", "MSFT": "416.79" }
}
You can skip the manual subscribe step entirely by setting autoSubscribe to true in your token claims. The channel is subscribed automatically when the connection is established.
Unsubscribe
To stop receiving messages from a channel, send a hotsock.unsubscribe message:
> {"event":"hotsock.unsubscribe", "channel":"live-updates"}
You'll receive a confirmation and immediately stop receiving messages from this channel:
{
"event": "hotsock.unsubscribed",
"channel": "live-updates",
"data": {}
}
When a WebSocket connection disconnects, all active subscriptions are automatically cleaned up.
If you're building with JavaScript, hotsock-js provides an easy to use interface for subscribing, unsubscribing, and message handling.