4 Building a Food Delivery App
This chapter covers
- Using SignalR for real-time two-way communication between the client and the server.
- Using OpenLayers for displaying interactive maps in the browser.
- Building a system capable of handling delivery driver’s location updates in real-time.
In this chapter, we will do something interesting with .NET Aspire. We will build a delivery-tracking app by using SignalR and OpenLayers.
Our app will work similarly to how existing popular food delivery tracking apps work, such as Just Eat, Uber Eats, and DoorDash. We will have a user interface with the map. The back end of the system will track the coordinates of the delivery driver. As soon as the driver moves, the marker on the map will be updated.
We won’t have to do anything ourselves, such as refresh the screen. The map will be fully interactive and will update automatically, just like it would in a real delivery-tracking app.
To bring this real-time tracking feature to life, we need to solve two main challenges: pushing live data from the server to the browser and rendering that data on an interactive map. We will use two powerful, specialized libraries for this: Microsoft's SignalR to manage the real-time communication, and OpenLayers to display the map. Before we write the code to integrate them, let's get a better understanding of what each one does.