Socket.io does not work with transport: ['xhr-polling']

I am trying to check fallback for polling in socket.io to make sure my application works with clients that do not support websites for any reason.

I use a very basic server / client example for Express 4. It works fine with:

// client-side var options = { transports: [ 'xhr-polling', 'websocket' ] }; var socket = io.connect('http://localhost:8080', options); socket.on('news', function (data) { console.log(data); socket.emit('my other event', { my: 'data' }); }); 

However, if I remove the "websocket" from the transport, nothing happens on the client side - there is no error, no events, nothing. On the server side, I see only:

 Tue, 03 Mar 2015 16:45:49 GMT socket.io:server serve client 304 
+4
Mar 03 '15 at 16:59
source share
1 answer

I opened the source code and found that socket.io.js now checks the polling string instead of xhr-polling . So this works:

 var options = { transports: [ 'polling' ] }; 
+9
Mar 03 '15 at 17:00
source share



All Articles