Help for owners
Messages in my app arrive late or out of order
Short answer
Live chat needs a connection that stays open between the app and your server. When it drops, gets blocked by a proxy, or the server cannot keep up, messages arrive late. A developer has to look at the connection, the server and any push messages together, because a delay can come from any of the three.
Does this sound like your situation?
- Messages show up minutes after they were sent.
- The chat works for a while and then freezes.
- People have to close and reopen the app to see new messages.
- Delays are worse at busy times.
- It works on Wi-Fi at the office and lags elsewhere.
Why does this happen?
The connection is a long-lived two-way channel
A WebSocket opens a two-way session between the app and the server so messages can be sent and received without polling. When that session drops, the app has no live path until it reconnects.
Confirmed by developer.mozilla.org
The server or proxy closes idle connections
A proxy or load balancer in front of your server can close a connection that has been quiet for some time, and then messages wait. The detail is on the fix pages linked below.
The app cannot keep up with a flood of messages
The WebSocket interface does not support backpressure. When messages arrive faster than the app can process them, it can fill memory, become unresponsive, or both.
Confirmed by developer.mozilla.org
The phone puts the app to sleep
On Android, when the screen is off and the device idle, the system suspends network access and defers background work. Real-time messages then need a push service to wake the app.
Confirmed by developer.android.com
What can I do about it today?
- Test with two phonesSend messages between two phones on the same Wi-Fi, then on different networks. Note when they arrive late.
- Note the exact delaySeconds, minutes, or only after reopening. Each points to a different cause.
- Check if notifications also lagIf push notifications arrive late as well, the problem may be larger than chat.
- Do not restart the server in a busy hourIt disconnects everyone at once and can make reconnects pile up.
- Ask your developer how messages are sentDirect connection, push messages or regular polling? This single answer narrows the search.
When should I bring someone in?
- Customers or staff rely on the chat to do their job.
- Messages are lost, not only late.
- The problem started as the number of users grew.
How do I handle it?
- Trace one message end to endI follow a test message from sender to server to receiver and note where the time goes.
- Check the connection pathI look at the proxy, timeouts and reconnect behaviour, because most real-time delays hide there.
- Check the load on the serverI test with many connections on a copy, never on the live system.
- Add a safety netI add a clear reconnect and catch-up so a dropped connection does not leave users stuck.
The price depends on what I find, so I quote in writing after a short discovery call. Tell me what is happening and I reply within 24 hours.
What do owners ask about this?
Is the chat service the problem or my app?
It can be either, or the connection between them. Tracing one message shows where the delay is.
Why does it work on Wi-Fi only?
Different networks can drop or restrict long connections differently, so test on more than one.
Do I need a paid chat service?
Not necessarily. First find the cause, then compare options with your actual numbers.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Found a mistake? Tell me.
For your developer: the technical fixes
WebSocket closes with code 1006 after roughly 60 seconds of no messagesWebSockets behind nginx drop when the connection is idleGET /socket.io/?EIO=4&transport=polling 404 (Not Found)Socket.IO answers 404 on the polling requestWebSocket connection to 'ws://localhost:8080/' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSEDThe browser cannot open the WebSocket: connection refusedHandshake failed due to invalid Upgrade header: nullSpring rejects the WebSocket handshake: Upgrade header is null