Troubleshooting realtime
Connections that close (4401, 4408, 1013), messages or database change events that don't arrive, gaps after reconnecting, and presence that looks wrong.
#The connection closes with 4401, 4408 or 1013
- Cause:
4401: the ticket was bad, expired or reused, or the user signed out.4408: a rule or limit refused the connection or a message (size, events per second).1013: the client didn't read fast enough. - Check: The close code in your
onStatus/onErrorhandler; the channel's rules; Realtime › Settings for limits. - Fix: Let the SDK fetch a new ticket; allow
SUBSCRIBEfor the channel; keep messages small; handle messages faster (Channels and connections). - Verify: The status reaches
liveand stays there.
#Published messages don't arrive
- Cause: The publisher isn't allowed to
PUBLISH, the channel names differ, or the receiver connected after the message was sent. - Check: The publish call's response (a refusal is an error there) and the exact channel names on both sides.
- Fix: Allow
PUBLISHfor the sender; after reconnecting, catch up with replay from the laststream_seqyou saw. - Verify: Both sides see the same messages, in order.
#Database change events don't arrive
- Cause: Change capture isn't on for that table, the write went through a direct Postgres connection, the statement changed no rows, or the listener may not subscribe to
db.table.<table>. - Check: Realtime › Database change data capture; how the write was made.
- Fix: Turn capture on for the table and allow
SUBSCRIBEon its channel (Database change events). - Verify: Insert a row through the API; an event with
row_count: 1arrives.
#subscribe() reports CHANNEL_ERROR (or showed SUBSCRIBED, then CHANNEL_ERROR)
- Cause: No channel rule lets this user subscribe, or they aren't signed in. Before JS SDK 0.10.5 and Python 0.12.3 a refused channel briefly showed
SUBSCRIBEDfirst; newer SDKs wait for the server to admit the join. - Check: The error passed to the
subscribecallback, and your channel rules forSUBSCRIBEon that name (Channels and connections). - Fix: Add a channel rule for that user or role; update the SDK so
SUBSCRIBEDmeans admitted. - Verify: The callback gets
SUBSCRIBEDonce, and other users still getCHANNEL_ERROR.
#Presence shows people who left, or one person several times
- Cause: A connection that vanished without closing stays listed for about 90 seconds; each tab or device is its own connection.
- Check: How many tabs or devices the person has open.
- Fix: Close connections when a page is left (
channel.close()); group presence by user id in your app (Presence). - Verify: After closing a tab, it disappears from presence at once.
#Someone on an older SDK is missing from presence, or stays listed after leaving
- Cause: Older SDKs (JavaScript up to 0.9.2 with
broadcast.ack, Python up to 0.11.2) sendtrackthrough the publish API. That presence is kept only for signed-in users with the channel's SUBSCRIBE rule, at most 10 per user per channel, and stays 90 seconds after the lasttrackunless the client untracks. - Check: The publish answer: a
presence_refusedfield says why the presence wasn't kept. - Fix: Update the SDK (presence then rides on the connection), or sign the user in and add a SUBSCRIBE rule for the channel (Broadcast, presence and table changes).
- Verify: A client that joins later sees the person in
presenceState()at once.
#Still stuck?
Email outreach@sovaria.in with your project URL, the time it happened (with time zone), the X-Request-ID response header or the trace_id from the error body, and the channel name and the close code. Never send keys, passwords, tokens or your users' data.