Socket.io - strange behavior on page reload

Hello to all,

I have a very simple javascript web application that connects to socket.io service. In Chrome everything works as expected, but I have slightly different behavior in Firefox.

What's the problem? Well, it's a shutdown that's called as soon as the client clicks the refresh button.

  • In Chrome, client behavior looks like this:
    • user download button
    • applicaiton calls socket.diconnect
    • page reloads
    • the client connects again.

-

  • In Firefox, on the other hand, these are different:
    • user download button
    • page reloads
    • applicaiton calls socket.diconnect
    • the client connects again.

So the reconnection is called after the page has been redirected not before.

So, I would like to know if there is a workaround for the path so that I can get it to work like it does now in Chrome. Or is it also possible that something is missing in my code?

client.js

    socket = io.connect('https://localhost:3090',
        { secure: true, query: { uData }, reconnect : true }
    );
    socket.on('disconnect', function (){
            console.log(' [Info] Disconnecting ..');
            socket.disconnect();
    });

      

Any help is appreciated, Alex

+3
javascript firefox socket.io


source to share


No one has answered this question yet

Check out similar questions:

3915
Why does Google add while (1); into your JSON responses?
2245
How do I refresh the page using jQuery?
2170
How can I change the url without reloading the page?
1904
Get the size of the screen, current web page and browser window
609
How to reload a page using JavaScript
thirty
Node.js: connection.io close client connection
7
Socket.io socket connection cannot be made a second time
2
Socket.io server is very late in registering client disconnects
1
Reset Socket.io client connection
1
Maintain connection with Socket.io



All Articles
Loading...
X
Show
Funny
Dev
Pics