Troubleshooting
Diagnose connection, authentication, publish, cluster fanout, recovery, push notification, and webhook problems one boundary at a time.
Start with the path that failed: connection, subscription, publish, fanout, history, or push. Sockudo is easier to debug when each boundary is checked separately, because each one fails in its own recognizable way. Use the table below to jump to the right section, then work through its checks in order.
Find your symptom
| Symptom | Likely boundary | Section |
|---|---|---|
The client never reaches connected | Network, TLS, proxy, or app key | Connection fails |
private- or presence- subscriptions are rejected | Your auth endpoint or signature | Private or presence subscription fails |
Backend publishes return 400 or 401 | HTTP API request signing | HTTP API requests are rejected |
| Publishes succeed but clients see nothing | Channel, protocol, or cluster fanout | Events publish but clients do not receive them |
| Reconnecting clients miss messages | Recovery configuration | Recovery or rewind is incomplete |
| Push is accepted but never arrives | Push providers and device state | Push notification publish is accepted but nothing arrives |
| Webhook signatures fail | Raw request body handling | Webhooks are rejected |
Connection fails
Verify the server is reachable and healthy. A healthy server prints OK:
curl -f http://127.0.0.1:6001/upThen confirm the app your client uses exists. An unknown app ID returns 404:
curl -s http://127.0.0.1:6001/up/app-idCheck the client host options:
new Sockudo("app-key", { wsHost: "127.0.0.1", wsPort: 6001, forceTLS: false, enabledTransports: ["ws"],});To take the client SDK out of the picture, open a raw WebSocket with Node.js 22 or later. A working server answers with connection_established right away:
node -e 'const ws = new WebSocket("ws://127.0.0.1:6001/app/app-key?protocol=7"); ws.onmessage = (m) => { console.log(m.data); ws.close(); };'{"event":"pusher:connection_established","data":"{\"socket_id\":\"9501381246.8633737996\",\"activity_timeout\":120}"}Common causes:
- using
forceTLS: trueagainst an HTTP-only local server - forgetting
enabledTransports: ["ws"]in local browser tests - proxying WebSockets without
UpgradeandConnectionheaders - sending clients to one host while HTTP publish uses another app environment
- using
app-keyagainst Docker Compose, whose app key isdemo-key - an app with
enabled = false, which rejects new connections
When the server closes the socket, the close code tells you why. 4001 means the app does not exist, 4004 means the app is over its connection quota, and 4009 means the connection was unauthorized. The full list is in Errors.
Private or presence subscription fails
Inspect the auth endpoint response. Private auth must return an auth value. Presence auth must return both auth and channel_data.
{ "auth": "app-key:signature", "channel_data": "{\"user_id\":\"42\",\"user_info\":{\"name\":\"Ada\"}}"}If signatures fail, verify:
socket_idis exactchannel_nameis exact- app key and secret match the Sockudo app
- presence
channel_datais serialized before signing - framework body parsers are not dropping form fields
If connections close with 4009 about an hour after connecting, the app has user authentication enabled and the client never called client.signin(). See User authentication.
HTTP API requests are rejected
Every HTTP API call must be signed with the app secret. Server SDKs do this for you, so these errors usually come from custom clients or misconfigured SDKs:
| Error | Cause | Fix |
|---|---|---|
400 with Missing authentication query parameters or Invalid authentication query parameters | The query string is missing or lacks auth_key, auth_timestamp, or auth_signature. | Sign the request, or use a server SDK. |
401 with a timestamp error | auth_timestamp is more than 600 seconds from the server clock. | Generate the timestamp per request and sync clocks with NTP. |
401 with body_md5 mismatch | The body was changed after hashing, or re-serialized by a middleware. | Hash and send the exact same bytes. |
401 with any other message | Wrong key or secret, or a signature over a different method, path, or query. | Check the credentials and compare the signed string with the request. |
First connection has a working signed curl example to compare against.
Events publish but clients do not receive them
Check the channel name and protocol mode first. Protocol V1 clients receive Pusher-shaped event prefixes. Protocol V2 clients receive Sockudo-native prefixes and V2 metadata.
Watch the counters while you publish a fresh event:
curl -s http://127.0.0.1:9601/metrics \ | grep -E '^sockudo_(connected|http_calls_received_total|ws_messages_sent_total)'sockudo_http_calls_received_total should rise with each publish, and sockudo_ws_messages_sent_total should rise as Sockudo delivers to subscribers. If the first moves and the second does not, no connection on that node is subscribed to the channel.
Also check:
- The publish and the subscription use the same app, channel, and event name, including case.
- The publish does not include the subscriber’s own
socket_id; Sockudo excludes that connection from delivery.
In a cluster, verify all nodes share the same adapter and cache configuration. Local memory adapters do not fan out between nodes.
Recovery or rewind is incomplete
Recovery depends on continuity. Sockudo should fail closed when the stream cannot be proven: if the replay buffer expired or the stream was reset, the client receives a resume failure and must rebuild its state instead of silently missing messages.
Check:
protocolVersion: 2connectionRecovery: true- replay buffer TTL and size
- channel-specific rewind limits
- adapter delivery latency and duplicate suppression metrics
The replay buffer is configured on the server:
| Key | Default | What it does |
|---|---|---|
[connection_recovery] enabled | false | Keeps the replay buffer that resume depends on. The sample config/config.toml sets it to true. |
[connection_recovery] buffer_ttl_seconds | 120 | How long a disconnected client can be away and still resume. |
[connection_recovery] max_buffer_size | 100 | Messages kept per channel for replay. |
The matching environment variables are CONNECTION_RECOVERY_ENABLED, CONNECTION_RECOVERY_BUFFER_TTL, and CONNECTION_RECOVERY_MAX_BUFFER_SIZE. For gaps longer than the buffer, use durable history; see History and recovery.
Push notification publish is accepted but nothing arrives
Push is asynchronous by design. A successful admission response means Sockudo accepted the publish, not that every provider delivered it.
Check in order:
- The device registration exists and is active.
- The device has a provider token for the target platform.
- The channel push subscription exists when targeting a channel.
- Provider credentials are configured for the platform.
- The publish returned a publish ID.
- The publish status shows how far the publish progressed.
- Provider delivery callbacks are reaching Sockudo when configured.
Read the status with the server SDK, which signs the request for you:
const status = await sockudo.getPublishStatus("pub_123");console.log(status);The underlying endpoint is GET /apps/{appId}/push/publish/{publishId}/status. Its lifecycle state shows whether the publish is still queued, planning, or dispatching, or has finished as succeeded, partially succeeded, failed, expired, cancelled, or dead-lettered.
Common push causes:
- APNs topic or environment mismatch
- Web Push VAPID key mismatch
- FCM project credentials for the wrong app
- expired device provider token
- client registration stored under a different
client_id - a server built without the
pushfeature or the provider’s feature, such aspush-apns
Webhooks are rejected
Webhook validation uses the raw body, not a parsed JSON object. Sockudo signs the exact bytes it sends and puts the signature in the X-Pusher-Signature header.
app.post("/sockudo/webhook", express.raw({ type: "application/json" }), (req, res) => { const webhook = sockudo.webhook({ rawBody: req.body.toString(), headers: req.headers, });
if (!webhook.isValid()) { return res.status(401).send("invalid signature"); }
res.sendStatus(200);});Keep the raw request bytes from your framework before JSON parsing mutates whitespace or key order. The SDK also checks that Content-Type is application/json, so a proxy that rewrites that header makes every webhook invalid.
Escalation bundle
When reporting an issue, include:
- Sockudo version (
sockudo --version) and feature flags - protocol version used by affected clients
- app manager, adapter, cache, and queue drivers
- relevant configuration with secrets redacted
- server logs around the failure
- metrics for connection, publish, fanout, history, and push
- a minimal client and server SDK reproduction