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
source to share
No one has answered this question yet
Check out similar questions: