educative.io

How can we efficiently broadcast the driver’s location to customers?

How can we efficiently broadcast the driver’s location to customers? We can have a Push Model where the server will push the positions to all the relevant users. We can have a dedicated Notification Service that can broadcast drivers’ current location to all the interested customers. We can build our Notification service on a publisher/subscriber model. When customers open the Uber app on their cell phones, they query the server to find nearby drivers. On the server-side, before returning the list of drivers to the customer, we will subscribe the customer for all the updates from those drivers. We can maintain a list of customers (subscribers) interested in knowing the location of a driver and, whenever we have an update in DriverLocationHT for that driver, we can broadcast the current location of the driver to all subscribed customers. This way, our system makes sure that we always show the driver’s current position to the customer.

is this an app notification through the mobile os or is this a separate notifications service that we built only for this app?

I would go with a websocket connection that receives an initial geo bounding box + zoom level (when map visible to the user) and sends back the dirver locations in that bounding box.
If the users zoom or pan the map the same connection can be used to update the interested area and receive updates accordingly. Websockets allows to minimize the required connections to open.