I'm using socket.io with Node.js. Everything works fine with websockets, but I have to support older clients like IE6 and similar. I had a lot of trouble using XHR (does not work at all on IE6) and htmlfile (sending from server works, but sending from client only works for first message). Getting desperate, I switched to JSONP and everything works great.
Looking at socket.io documentation, the recommended order is:
io.set('transports', [
'websocket'
, 'flashsocket'
, 'htmlfile'
, 'xhr-polling'
, 'jsonp-polling'
]);
Why is this recommended, when JSONP seems to be more reliable than htmlfile and xhr-polling?
Here's what I discovered:
JSONP produces ugly flashes on the screen with Firefox and does not work nice with Opera. So, XHR is better for older Firefox versions and for Opera.
The best solution seems to be configuring the transports on the client after detecting the browser and version.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With