Channel Lifecycle
Channels are ephemeral topics. The meaningful lifecycle for clients is the subscription on a Socket channel.
Channel events (SDK)
Listen on the channel object:
| Event | Meaning |
|---|---|
subscribing | Subscribe in flight |
subscribed | Server acknowledged subscribe |
unsubscribing | Unsubscribe in flight |
unsubscribed | Server acknowledged unsubscribe |
paused / resumed | Local pause state |
failed | Subscription failure |
const channel = socket.channels.get("demo");
channel.on("subscribed", () => console.log("ready"));
channel.on("failed", (payload) => console.error(payload));
await channel.subscribe((msg) => console.log(msg.data));
After reconnect
With autoResubscribe: true (default), the SDK resubscribes to channels that were active before disconnect. Wait for connected (or channel subscribed) before assuming delivery has resumed.
Server-side cleanup
Unused channels are managed by the platform. You do not archive or delete channels via the public API.
Related
Previous
Using Channels
Next
Pub/Sub