Full-StackFeb 09, 202610 min read

Real-time rider tracking with Socket.IO + Redis

The customer wants to watch the rider move. The rider wants to broadcast their location without killing their battery. Here is how the Bonjegs delivery tracking works.

Jhastine MacalinoWordPress · Front-End · Technical SEO · Pampanga, PH

The customer-facing requirement is simple: open the order page, see the rider's pin move toward your house, get a notification when they are nearby. The implementation is where the interesting tradeoffs live.

The data path

The rider app emits GPS coordinates over a Socket.IO room scoped to the order. The API receives the position, stores the latest in Redis (TTL 30s), and re-broadcasts to the customer's socket. The customer app interpolates between updates for smooth movement.

The battery question

Streaming GPS continuously melts a phone. We throttle: emit at most every 4 seconds, only while the rider has the app foregrounded with an active delivery. The arrival-radius alert is calculated server-side so the rider's app does not have to hold the customer's address.

— Read next

GCash via PayMongo webhooks