Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages

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.

  • Written for business owners
  • Updated
  • By Maaz Zindani, Senior Software Engineer

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?

  1. 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.

  2. 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.

  3. 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.

  4. 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.

What can I do about it today?

  1. Test with two phonesSend messages between two phones on the same Wi-Fi, then on different networks. Note when they arrive late.
  2. Note the exact delaySeconds, minutes, or only after reopening. Each points to a different cause.
  3. Check if notifications also lagIf push notifications arrive late as well, the problem may be larger than chat.
  4. Do not restart the server in a busy hourIt disconnects everyone at once and can make reconnects pile up.
  5. 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?

  1. Trace one message end to endI follow a test message from sender to server to receiver and note where the time goes.
  2. Check the connection pathI look at the proxy, timeouts and reconnect behaviour, because most real-time delays hide there.
  3. Check the load on the serverI test with many connections on a copy, never on the live system.
  4. 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

Next step

Want this off your desk?

Send me a few lines on where things stand. I reply within 24 hours.