Long Polling
Long Polling is a technology where the client requests for data from the server while waiting for an extended period, essentially making an HTTP request to a server and keeping the connection open to enable the server to reply later. The server permits about 6 parallel connections from the browser using long polling.
Advantages of Long Polling
- Little or no support is needed for fallback layers.
- Short waiting period.
- Easy to implement.
Disadvantages of Long Polling
- Latency issues may arise.
- Doesn’t offer efficient resource utilization.
- Various kinds of delays during the process.
WebSocket
WebSocket is a computer communication protocol enabling full-duplex communication channels over a single TCP connection. It allows real-time data transfer between a browser and a web server with low weight overhead.
Advantages of WebSocket
- Allows two-way communication.
- Compatibility between platforms.
- Enables faster data transfer than HTTP.
Disadvantages of WebSocket
- Does not provide edge caching.
- Lacks AJAX-like success mechanisms.
- Web browsers must be fully HTML5 compliant.