Reference

Use case of Long Polling

Long polling is better for cases where messages are sent infrequently, and not in bursts. (Dropbox is a good example, where file updates are sent over long polling. People would get fairly quick notifications of the update, but you wouldn't expect many updates to arrive in rapid succession, nor are they predictable). But if the client wants frequent updates in real-time, long polling handles it poorly.

Use case of Websocket

Chat app. Burst of messages

Short Polling

Long Polling

Pro:

Con:

WebSocket