Socket.IO stops working with Google Chrome 43.0.2357.65

Please help me!

After updating to the latest version of Google Chrome (43.0.2357.65) on my site, socket.io stops working.

It sends too many requests and creates a new socket connection every time.

Screenshot of Google Developer Tools Network on my site: http://i.stack.imgur.com/TLXGg.png

But the demo on socket.io site http://socket.io/demos/chat/ works great.

Network screenshot to showcase socket.io://i.stack.imgur.com/QWNW2.png

I am using this code on the client:

 $.getScript('http://localhost:1337/socket.io/socket.io.js', function () {
   var socket = io.connect('http://localhost:1337/?token=ABCDEF');
 });

      

In other browsers the code works fine, and in google chrome before updating it works fine

Socket.io version 1.3.5

In the console, I have these debug messages:

engine.io-client:polling-xhr xhr open GET: //it.iksys:1337/socket.io/?token=410235d6a03ead4497fa18037e8da5d73133367d&EIO=3&transport=polling&t=1432302871093-738 +1ms  
socket.io.js?_=1432302864284:3715 engine.io-client:polling-xhr xhr data null +1ms  
socket.io.js?_=1432302864284:3715 engine.io-client:polling polling got data ok +4ms  
socket.io.js?_=1432302864284:3715 engine.io-client:socket socket receive: type "error", data "parser error" +0ms  
socket.io.js?_=1432302864284:3715 engine.io-client:polling polling +1ms  
socket.io.js?_=1432302864284:3715 engine.io-client:polling-xhr xhr poll +1ms  
socket.io.js?_=1432302864284:3715 engine.io-client:polling-xhr xhr open 

      

+3


source to share


1 answer


I found a solution for defining only the websocket transport for the client:

NodeJS:

var options = {};
options.transports = ['websocket'];
var socket = io.connect('http://localhost:1337/?token=ABCDEF', options);

      



Angular 4:

 this.socket = io(environment.socketURL, {  upgrade: false, transports: [ 'websocket' ], query: {token: TokenService.token()}});

      

I believe this version of Google Chrome has some issues with xhr polling.

+2


source







All Articles