JOIN MY SPONSORS

Channels

A channel is a named room that clients connect to. Everyone on the same channel receives every message sent to it.

Channel Names

Channel names can be any string. Use whatever naming convention makes sense for your app:

channels.js
connect('chat')            // simple name
connect('game:lobby')      // may fall under a "game" namespace
connect('myapp:foo:bar')   // may fall under a "myapp" or "myapp:foo" namespace 

The : or / has special meaning — it creates a boundary for namespace prefixes. Generally, this may not matter, but you if you attempt to set join or send keys on the channel, and it falls under a namespace reservation, your connection will be rejected.

Lifecycle

Channels are ephemeral:

  • Created when the first client connects
  • Destroyed when the last client disconnects
  • No TTL, no keepalives, no persistence

This means channels are completely free to create. You don't need to register or configure them ahead of time — just connect to any name and it exists.


Next: Sending Messagessend strings, objects, typed payloads, and direct messages.