- Notifications
You must be signed in to change notification settings - Fork10.1k
closeOnBeforeunload not working properly after upgrading to socketio v4.7.5#5055
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
With following configuration when I try to leave the page on Firefox the socket connection is disconnected and if I try to log the reason for disconnection it says "transport error " |
BetaWas this translation helpful?Give feedback.
All reactions
Hi! When settingcloseOnBeforeunload: false, the Socket instance will indeed emit adisconnect event when the user reloads the page on Firefox.
Reference:https://socket.io/docs/v4/client-options/#closeonbeforeunload
Replies: 3 comments 1 reply
-
@darrachequesne can you provide any input here? |
BetaWas this translation helpful?Give feedback.
All reactions
-
Hi! When setting Reference:https://socket.io/docs/v4/client-options/#closeonbeforeunload |
BetaWas this translation helpful?Give feedback.
All reactions
-
But if I set it to true is silently closes the transport and I am unable to emit any event. |
BetaWas this translation helpful?Give feedback.
All reactions
-
I was not able to reproduce the issue:https://github.com/socketio/socket.io-fiddle/tree/socket.io/discussions/5055 The window.addEventListener("beforeunload",()=>{console.log("beforeunload");socket.emit("bye");}); Same behavior on Chromium (v123) and Firefox (v127) on Ubuntu 22.04. Am I missing something? |
BetaWas this translation helpful?Give feedback.