The first subscribe() opens a WebSocket. The client keeps it healthy: heartbeats, automatic reconnecting, and rejoining your channels. You rarely need more than the status.

Status

Show a small “reconnecting” hint when the status isn’t open. Channels rejoin by themselves.

Open and close

Disconnect when you discard a client (on sign-out) so timers stop. In Python, async with AsyncPawabase(...) does it for you.

Options (TypeScript)

One-way streams

If you only listen (a dashboard, a server process) use Server-Sent Events over plain HTTP: no socket to manage, works through strict proxies. Up to 20 channels per stream.
Frames are welcome, message and presence_diff. To send, use publish. Stop with an AbortSignal (TypeScript) or by breaking the loop.

Signing in and out

The connection follows the person. When the access token refreshes the socket stays alive; when they sign out, channels that needed a person close. After a new sign-in, subscribe again.

What can go wrong

Watch connections open and close in Studio: Services → Realtime → Connections and Overview.

Protocols

Other ways to connect.

Troubleshooting

Fix connection problems.