Supporters
JOIN MY SPONSORS

Namespaces

A namespace is a prefix you reserve to control all channels under it. If you reserve myapp, you control every channel that starts with myapp:.

How it Works

Without a namespace, anyone can create any channel — it's the Wild West. Namespaces let you fence off a section:

  • myapp:chat — controlled by the myapp namespace
  • myapp:notifications — also controlled by myapp
  • myapp — exact match, also controlled
  • myapps:somethingnot controlled (different prefix)

The colon (:) is the separator. A namespace myapp only matches channels named exactly myapp or starting with myapp:.

Reserving a Namespace

Sign in with GitHub, then go to Reservations to reserve a namespace. Each account gets up to 5 namespace reservations.

Once reserved, you can set default join keys and send keys that apply to all channels under your namespace. See Access Control for details.

Sub-namespaces

Need different access rules for a specific channel path? Register a more specific namespace. If you own myapp, you can also register myapp:private with its own keys.

The most specific namespace always wins. A connection to myapp:private:room1 uses the config from myapp:private, not myapp.

Namespace Matching

When a client connects to a channel, the server finds the longest matching namespace:

ChannelNamespace MatchResult
myapp:chatmyappNamespace config applies
myapp:private:room1myapp:privateMore specific match wins
myappmyappExact match — config applies
myapps:chatnoneOpen channel
random-roomnoneOpen channel

This matching is powered by a character-level trie for O(k) lookup, where k is the channel name length. It's extremely fast.

Collision Protection

Only the owner of a root namespace can create sub-namespaces under it. If you own myapp, no one else can register myapp:anything. This prevents namespace squatting within your prefix.

Reservation Benefits

Even a namespace with no keys set still protects your channels. Without a reservation, the first person to connect to a channel can set their own ephemeral keys (see Access Control). With a namespace reservation, this is blocked — only your configured keys apply.


Next: Access Control — set join and send keys to control who can do what.