Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NodeJS & Socket.io: Chrome not loading with WebSockets

Chrome is loading with long polling, and the loading indicator doesn't stop.

Why is Chrome not using WebSockets, and how can I prevent the loading indicator from spinning when it does use long polling?

I'm using the latest socket.io and nodejs v2.5

--

The first time I connect, it uses Websocket, but disconnects right away and reconnects with xhr-polling.

like image 559
Luke Burns Avatar asked Nov 21 '25 21:11

Luke Burns


1 Answers

I had a similar problem and I found that there was a socketio cookie overriding the transport method to "xhr-polling". I don't know how the cookie got there, but deleting it did the trick.

Here's a reference to the line that looks for the cookie. https://github.com/LearnBoost/Socket.IO/blob/master/socket.io.js#L1023

like image 146
mbrevoort Avatar answered Nov 23 '25 22:11

mbrevoort



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!