Let me give you a trivial example about a taxi. The client orders a taxi and clicks the order button, then the data was sent to the server and the taxi driver sent the order. When the order is accepted, the answer goes to the server with the data about the driver or what they come with (it doesn't matter). The client receives a response and looks at the information about the driver.
How does the client receive a response with information? After all, after sending, everything does not happen right away, for some time the order weighs in anticipation of being accepted and then data from the information comes to a specific client when the order is accepted.
How to make a similar thing, maybe there is material on this topic or something else you would advise to read.
Typically, this functionality is done via Socket or WebSocket.
Thus, all taxi drivers and all clients are hacked to the same server with a socket connection.
Accordingly, everyone connected to the server can both send information to it and receive data from it.
The client sent a request for a taxi over a socket. The server processed the request, transmitted the order information to all taxi drivers in the specified area using the same sockets. The taxi driver saw the order, clicked agree to the order and sent a request to the server to accept the order. The server saw the request from the taxi driver and transmitted information about it to the client. The client caught this in the application, the UI was updated and the information about the taxi driver is visible to the client. At the same time, until the order is accepted in the same way by timer, the taxi driver can provide data to the client about his location, for example.
In more complex versions, it is better to create a separate stream for each socket connection, use a database on the server to store some kind of persistent data, and so on.