Book an appointment

HomeBlog

Why live order tracking runs on WebSockets

Engineering · 3 min read

A customer who has just paid wants one thing: to know where the order is. On ClickToFood that status travels over WebSockets rather than repeated requests. Here is the reasoning.

Polling asks, a socket tells

With polling, every open app asks the server “anything new?” every few seconds. Most answers are “no”, and the real update can still arrive a full interval late. A WebSocket keeps one connection open, so the server sends the change the moment it happens.

When does the app find out? PollingWebSocket Order is ready nothing new waits for the next requestApp updates App updates at once
0:00 / 0:08
Polling compared with a WebSocket, in eight seconds.

What to plan for

  • Connections drop. Phones switch networks all the time. On reconnect, the app asks for the current state instead of trusting what it last saw.
  • The database stays the source of truth. The socket delivers updates. It does not store them.
  • Send small events. “Status changed” or “rider moved” is enough. Sending the whole order every time wastes data on mobile.

When polling is still fine

If a screen changes a few times a day, like a sales report, a simple refresh is cheaper to build and run. Use sockets where waiting is noticeable.

Book an appointmentAll posts

Keep reading

  • Engineering · 3 min read

    Why live order tracking runs on WebSockets

    A customer who has just paid wants to know where the order is. Here is why we push that status over an open connection instead of asking for it again and again.

    Read article
  • Product · 3 min read

    Five products, one order: how to scope a delivery platform

    Customer app, rider app, restaurant panel, admin and point of sale look like five projects. Scoping them around a single order keeps them one product.

    Read article