3 ms·
If you're using HTTP use websockets or server-sent events, not long polling. Long polling is obsolete.
by IshKebab 5y ago
If you're using HTTP use websockets or server-sent events, not long polling. Long polling is obsolete.
- gremlinsinc 5y agoWebsockets can cause issues especially if you're not closing sockets properly, or have too much activity on a small server etc... Livewire for instance accounts for this by just polling every 2 seconds for changes, this is much more performant than keeping 10000 sockets open if people leave open the page/app but don't actually do anything... Straight long-polling should be avoided, but intermittent polling is a good solution for performance when you don't want to use all your socket bandwidth.
- azinman2 5y agoMy understanding is that long polling is the thing that will reliably work at scale. Perhaps this changed in the past few years, but I’ve asked various companies like PubNub why they only use long polling and the answer was that there are too many incompatibilities out there in the wild for anything but that.
- IshKebab 5y agoServer-Sent Events are very reliable. What you might be thinking of is the fact that you probably shouldn't rely just on server push. But that doesn't mean you should use long polling. You should use normal short polling and Server-Sent Events. Also it makes no sense to say long polling is more reliable than SSE, because SSE is essentially a non-hacky implementation of long polling.