Due to it's nature, EventSource can be quite easily implemented using a polyfill for legacy browsers.
It's also MUCH easier to setup/run in a multi-layered stack (e.g. Pound/HAProxy > Varnish > App Server). As per usual, WebSockets is what the "cool kids" use, even when it's often much less appropriate and much less flexible.
So what would you use to implement the polyfill for IE10? Is there something more appropriate than websockets? If not, are we not back to square one where you may as well use websockets from the start?
If your server side stack (https terminator, load balancer, caching proxy, app/web server) can't support websockets, you'll be falling back to long polling in every browser.
No, you are polling for every IE user. Which is likely a majority of your visitors. You can control your server side stack, you can't control your visitor's browser.
My argument is that since IE does not support EventSource a large portion of your userbase will have to use an alternative implementation. If this implementation polls then you get minimal gain since now the majority of your userbase is polling again.
It isn't 2003, IE is not likely to be a majority of visitors any more.
Caniuse.com reports 75% global relative support for EventSource and just 85% for websockets. To claim that "you can control your stack" as a solution to a protocol that has well known issues with multiple components in the path between a client and the server is somewhat naive frankly. As for the "pull vs push" debate: event source lets you open a channel to a resource on the server and wait for it to send you data. XHR long polling works exactly the same way - you open an asynchronous connection and wait for data, the only difference is you need to handle reconnects, and the message parsing is done in user land code rather than in c/whatever. Long polling is definitely not about making a new xhr request every couple of seconds to check for more data.
Comments (140) 32 threads
Show all comments
Showing thread 12 of 32
I've used this for UI's where the server continuously sends/pushes updates to the clients. Really handy, and multiple implementations and libraries available in most languages.
Of interest is perhaps also the spec [2]
[1]: https://developer.mozilla.org/en-US/docs/Web/API/EventSource
[2]: https://html.spec.whatwg.org/multipage/comms.html#the-events...
And WebSockets is working since IE10 https://status.modern.ie/websocket?term=WebSocket
It's also MUCH easier to setup/run in a multi-layered stack (e.g. Pound/HAProxy > Varnish > App Server).
As per usual, WebSockets is what the "cool kids" use, even when it's often much less appropriate and much less flexible.
The key thing is that a proxy/load balancer doesn't need special cases to support EventSource like it needs (and often doesn't have) with websockets.
If your server side stack (https terminator, load balancer, caching proxy, app/web server) can't support websockets, you'll be falling back to long polling in every browser.
My argument is that since IE does not support EventSource a large portion of your userbase will have to use an alternative implementation. If this implementation polls then you get minimal gain since now the majority of your userbase is polling again.
Caniuse.com reports 75% global relative support for EventSource and just 85% for websockets.
To claim that "you can control your stack" as a solution to a protocol that has well known issues with multiple components in the path between a client and the server is somewhat naive frankly.
As for the "pull vs push" debate: event source lets you open a channel to a resource on the server and wait for it to send you data.
XHR long polling works exactly the same way - you open an asynchronous connection and wait for data, the only difference is you need to handle reconnects, and the message parsing is done in user land code rather than in c/whatever.
Long polling is definitely not about making a new xhr request every couple of seconds to check for more data.
Continue this thread — 1 reply