WebSockets
WebSockets are another way to connect to and send/receive data from a server. With WebSockets, a client will connect to the server and then subscribe to certain channels. The clients can then push data to a subscribed channel. The server will receive this data and then broadcast it to every client that is subscribed to that specific channel. This allows multiple clients to all receive real-time updates without having to make API calls manually, potentially flooding the server with GET requests. Most chat apps use WebSockets to allow for real-time communication, and everyone in a group message will receive the message as soon as one of the other members sends one. Websockets allow for more of a streaming approach to data transfer than traditional Request-Response API’s, because Websockets broadcast data as it’s received.