A channel is a name. Everyone subscribed receives what is sent to it. Use a prefix and an id so one channel rule covers a group of them: chat:lobby, order:42, doc:abc. Who may join and send is decided by the rule you set in Studio (Services → Realtime → Channels). By default signed-in users may join and send.

Subscribe and listen

Asking for the same name twice returns the same channel, so parts of your app share one subscription. The first subscribe() opens the connection.

What a message holds

Send

It resolves with the message id once the server accepts it. You also receive your own messages, so render from what the channel delivers instead of adding yours twice. If the Publish policy refuses you (or Apps may publish is off), send throws RealtimeError. You can publish without subscribing (pawabase.realtime.publish(channel, event, payload)), which also works on the synchronous Python client.

Listen to one event or all

Python: room.on(None, handler) for every message; room.on("typing", handler) for one.

Read as a loop

The loop ends when you unsubscribe.

Typed payloads (TypeScript)

In React

Naming channels

Errors

subscribe() and send() throw RealtimeError when a rule refuses: not signed in while the rule needs a user, wrong organization, the key is wrong. Check the rule in Studio, then Activity.

Presence

Who is here.

History

Messages for latecomers.