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.
