WebSocket

You might say

How does a chat room receive new messages in real time?

A connection that stays open, letting both sides send messages at any timeLive chat and collaborative editing may use WebSocket when both sides need frequent messages. An HTTP request and response form one message exchange, but the underlying HTTP connection can be reused and HTTP/2 can multiplex streams. After its handshake, WebSocket exchanges messages in both directions over one connection. Applications can add heartbeat checks and reconnection or state-recovery logic as needed; the connection can still drop.
Know first
WebSocket
Further reading