𝗦𝗲𝘀𝘀𝗶𝗼𝗻 𝟱 𝗦𝘂𝗺𝗺𝗮𝗿𝘆
I studied three ways to move data between a client and a server in my system design class today.
Short Polling The client asks the server for updates at set times. You might set an interval of 5 seconds. The client sends a request every 5 seconds to check for new data.
Long Polling The client sends a request to the server. The server holds the request until new data arrives. This method uses more server resources. It also wastes many connections.
Server Side Events The server sends data to the client at regular intervals. In Javascript, you use the EventSource object to create this connection. The server pushes data to the client automatically.