Real-Time Message Not Arriving? 8 Places It Dies in Laravel
Raheel Shan
December 2nd, 2026 · 11 min read
In article 1, the worst part of every setup was the silence. The event left Laravel and nothing arrived, with no error anywhere.
A hub has the same problem in a different shape. A message crosses eight stages, and each one can drop it without telling the user.
Here is the path, with the symptom, the place to look, and the fix at each stage.
The path
token → connect → join → send → route → hub → webhook and listener → onEvent
Walk it left to right. The first stage that fails is your bug. Durable chat messages use route, and typing and presence skip it. Only one-to-one messages use webhook and listener.
1. The token
Symptom: the connection never opens, or fetchToken throws.
Look at: the response from your /hub-token route.
- 401: wrong secret, unknown app key, or an inactive app
- 400: a bad user id (1 to 128 characters from
A-Z a-z 0-9 _ - . : @), or a bad channel name - 429: more than 300 token requests a minute from one address
A userId of (string) auth()->id() is "" when nobody is signed in, which is a 400. Keep the route behind auth.
2. The connection
Symptom: the token works and the status stays connecting or flips to disconnected.
Look at: the onStatus callback and the browser's network tab, filtered to WS.
onStatus: (s, err) => console.log('hub status', s, err?.message),
- Origin refused: a browser on an origin that is not in the app's allowed list fails to connect. Check the exact scheme, host and port (
http://localhost:3000andhttp://localhost:5173are different entries). - A channel in the connection address that the token does not allow: the hub closes the connection. The status flips to
disconnectedright after it opens. - Status
reconnecting: the client retries on its own at 0, 2, 5, 10, then 30 seconds.
3. The join
Symptom: joinChannel throws.
Look at: the error text. The hub tells you why.
- "This token does not allow that channel.": the token's
channelslist did not include it. Either the user is not a member, or the client is holding a cached token from before they joined - Invalid name: channel names use 1 to 64 characters from
A-Z a-z 0-9 _ - . - The 20-channel limit: a connection can be in 20
- "Rate limit exceeded.": joins and leaves use the connection's rate
After a membership change, await client.stop(); await client.start(); clears the cached token.
The opposite surprise has no error. If a token has no channels key, the app is in open mode and anyone can join anything. Check that the key is always sent.
4. The send
Symptom: send() or sendToChannel() rejects.
- "Not connected to the hub.": the status was not
connected. The SDK does not queue a message sent while reconnecting - "Join the channel before sending to it.": a client can only send to channels it is in
- "Rate limit exceeded.": more than 10 messages a second on one connection (burst 20)
- "App rate limit exceeded.": the whole app passed 100 a second (burst 200)
- "Payload does not match the schema for 'typing': ...": the schema refused it, and the message names the field
- A strict-mode refusal: the event name has no schema
Show these messages in the UI during development. A swallowed catch {} hides every one of them.
5. The route
Symptom: a durable message does not appear for anyone, and the sender sees an error or a spinner.
Look at: the response from POST /rooms/{room}/messages.
- 422: validation refused it
- 403: the policy says the user is not a member, which is correct for a stranger and a bug for a member
- A 200, saved, and nobody received it: the broadcast failed
That last one is the silent case. The route catches the failure so the sender is not told their saved message failed, which means you must log it:
try {
RealtimeHub::broadcast("room.{$room->id}", 'room.message', $payload);
} catch (RealtimeHubException $e) {
Log::warning('realtime: broadcast failed', [
'room' => $room->id,
'status' => $e->status, // 0 means the hub was unreachable
'error' => $e->getMessage(),
]);
}
The status tells you why: 401 is a wrong key or secret, 429 is a rate limit, 0 is a network failure, and anything 5xx is the hub. The recipients' history route fills the gap, so a failed broadcast loses no data.
6. The hub
Symptom: the route succeeded, the broadcast succeeded, and a user does not see the message.
Three causes, and none is an error:
- The user is not in the channel right now. A channel message is not held for anyone who is not connected. They catch up from history
- The user is in another room. Check which channel the client joined
- For a one-to-one send, the recipient id does not match.
tomust be the same string the token route used."5"and"05"are different users
The hub cannot tell whether a user is online, and recipients in a user send is how many it accepted the message for, not how many received it.
Check the hub's status page, linked from the docs, for an outage before you debug your own code.
7. The webhook and the listener
This stage applies to one-to-one messages only. Channel messages never reach it.
Symptom: the sender sees success, the other user sees nothing, and your database has no row.
Look at: your web server's access log for the webhook URL. If the hub never reached it, nothing below this stage runs.
- The URL must be public https. The hub refuses private network and cloud metadata addresses and does not follow redirects. A local dev server needs a tunnel.
- 401 from your route: the
RealtimeHub-Signaturecheck failed. The secret in.envis wrong, or the body was altered on the way - A request older than 300 seconds is refused. A server clock that is wrong by more than that fails every request
- The listener took too long. It has 10 seconds. Queue slow work
- A non-2xx response makes the hub retry after 30 seconds, 2, 10, and 30 minutes, then set the messages aside after the fifth failure
- No URL was saved when the message was sent. Messages sent while no webhook is set are not delivered later
The dashboard has a "Send a test event" button. Press it first. If the test arrives and real messages do not, the problem is above this stage.
The package also gives you a way to test the route without the hub: sign a request yourself with the secret and post it. Its README shows the PHP.
A listener that returns early is the silent part. Log what it ignores:
default => Log::warning('realtime: unhandled event', ['event' => $e->eventName, 'from' => $e->from]),
A retry that your unique hub_event_id column rejected also ends quietly. That one is correct. Log it at info.
8. The onEvent handler
Symptom: the message reached the browser, you can see it in the WS frames, and nothing shows.
- The
ifonm.eventdoes not match.room.messageandroomMessageare different names - The channel check hides it. The message belongs to a room that is not the active one, so it went to the unread badge
- It was your own message. The sender hears their own channel messages, so skip
m.from === mefor typing - A
$presence.joinor$presence.leavefell through. With the browser client they go toonPresence, so a presence handler that is missing means nobody sees them. WithoutonPresencethey arrive inonEventfrom$serverwithchannelset, and a handler that expects a text payload ignores them - The shape changed.
m.payload.roomis a number on the server and a string after some round trips, and===fails
Log everything that arrives while you debug:
onEvent: (m) => {
console.log('hub event', m);
// ...
},
Debugging order
- Press "Send a test event" in the dashboard. If it arrives, stage 7 works
- Check the token route response, including the
channelslist, then theonStatushistory - Read every
joinChannelandsend()error out loud, since they are written for you - Check the response of the post route, then the application log for
realtime: broadcast failed - Grep the access log for the webhook URL if it is a one-to-one message
- Look at the WS frames in the browser
Work left to right and stop at the first stage that fails.
Three logs to keep in production
- Every failed broadcast, with the status code
- Every webhook rejection (signature, timestamp, exception)
- Every event the listener ignored
Silence was the problem in article 1. On a hub it is the same problem. A warning line fixes it.
Try it: realtimehub.raheelshan.com/docs
Previous: A React Native Chat Client for Your Laravel Real-Time Hub
Next: How to Leave a Hosted Hub for Laravel Reverb in One Afternoon
Comment "TRACE" and I'll send you the debugging order as a one-page checklist.
Found this useful?
Support the work that goes into these posts.