WebSocket (real-time connection)
Chat, live maps and online status all run on this: a connection between app and server that stays open, so updates arrive the instant they happen.
Updated October 2026 · with examples from our own builds
What does WebSocket mean in practice?
Ordinary web requests are one question and one answer. A WebSocket keeps a line open in both directions, which is what chat, live tracking, typing indicators and online status depend on. Libraries such as Socket.IO add rooms, reconnection and fallbacks on top.
Scale is where it catches people out. One server can hold its connections in memory, but once there are several server processes, a message sent on one must reach a phone connected to another. That needs a shared layer, usually Redis, and its absence is a common reason chat 'randomly' fails to deliver.
Open connections also need housekeeping: presence that expires when a phone drops off, limits on chatty events such as typing, and a way to catch up after the app has been in the background.
WebSocket at a glance
- Used for
- Chat, live location, presence and live dashboards
- Scaling need
- A shared adapter across server processes
- Common bug
- Messages reaching the server but not the recipient
Where has WebSocket come up in our builds?
The mobile API runs one Node.js worker per CPU core, and Socket.IO kept its rooms in each worker's memory, so messages could stop at the server. We moved Socket.IO onto the Redis adapter and gave each person a personal room that all their sockets join, so a message reaches the chat list and the open thread on every device.
Presence records in Redis expire after five minutes unless a heartbeat renews them, so a dropped connection can't leave someone online for good, and typing events are rate-limited per user on the server.
The driver's position streams to the customer over Socket.IO, which costs nothing per update; only the road route drawn on the map is a billed call.
Common questions about WebSocket
Why do chat messages sometimes appear only after a refresh?
A common cause is a backend running several processes without a shared real-time layer, so an event emitted on one process never reaches a phone connected to another. A Redis adapter, plus pushing to each user's personal room, fixes that class of bug.
Are real-time features expensive to run?
They hold a connection per active user, so servers need memory for them, but streaming small updates is cheap. On Pakka, streaming the driver's position costs nothing per update; the expensive part was the map route, a separate paid call.
Related terms
Sources
Planning a product and not sure where WebSocket fits? Ask us, or browse all 116 terms in the glossary.