Design a real-time geospatial location indexing and dispatch platform handling driver location streams, rider matching within 5 seconds, route ETA calculations, and dynamic surge pricing.
Sends GPS location payload { lat, lng, status, bearing } every 4 seconds via WebSocket.
Terminates 1M driver WebSockets and ingests GPS streams with sub-second response.
Maps lat/lng to H3 Hex Cell ID (Resolution 8/9 ~500m area) and maintains list of driver IDs in cell.
Finds top 10 closest drivers in expanding ring search, calculates ETA, sends ride offer.
Computes ride multiplier by analyzing rider requests vs driver supply in local H3 cell.
Stores trip state transitions (REQUESTED, MATCHED, IN_PROGRESS, COMPLETED).
WebSocket ping sent every 4 seconds.
Update driver position in spatial memory index.
Rider requests pickup.
Query nearby available drivers within 2km radius.
Driver receives pop-up to accept or decline.
Atomic lock transition claims trip for driver.