What | Usecase | Keeps Connection open | |
---|---|---|---|
1. Pooling / Pull Method | Client repeatedly sends requests to the server at regular intervals to check for updates |
When near real-time updates are required | No |
2. Long Pooling | client sends a request to the server, and the server holds the request open until new data is available or a timeout occurs. |
When near real-time updates are required | Yes |
3. Websockets | Full-duplex long-lived connection. Both the client and server can send messages to each other at any time. |
- For low-latency and high-frequency data updates, such as - chat applications, real-time collaborative editing, and online gaming. |
Yes |
4. Webhooks (Event Driven Architecture) |
- These are HTTP callbacks initiated by the server to notify a client when specific events occur. - Client provides an endpoint, and the server sends HTTP requests to that endpoint whenever relevant events happen |
notifying clients about new data, updates, or changes. | No. Server calls client endpoint(APIs) on data |