Normally the server-client communication works like this: the client sends some request (GET, DELETE, PATCH, etc) and the server responds client with some data. Is it possible to achieve that server sends the data to the client without the client sending request first? To be more specific, I am wanting to build a chat room app. So when A sends a message to B, A will send a request to the server (together with that message), but B does know about this hence B does not want to request all of B's messages from the server. So how can B get notified in this case?
Without any information at all having been sent recently, this would only be possible if there's a reliable direct path to the client, and the client is also a server that can listen to requests. This approach will probably only work for clients with their own stable static IP addresses, and not from the average internet customer behind carrier-grade NAT.
But if the client can make an initial connection to the server when the client's app comes online - which is extremely typical of apps similar to what you're describing - you can set up a websocket connection at that point, allowing both the client and server to send information to each other.
Create a websocket connection to the server when the client comes online. Then, when the server sees a message change that it wants to communicate to clients, the server can iterate over all still-active websockets (or, if desired, only the still-active websockets that also need to update in response to the message), and send a message through each of them, and each connected client can see the message from the server.