You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The pageshow event handler calls this.connect() that returns early if there's an active connection - if(this.conn){ return }.
The pagehide event is supposed to clear the this.conn field by calling this.disconnect() that calls this.teardown. Unfortunately, the code that actually clears the this.conn field is executed asynchronously. As user has already navigated out of the page the the code is not executed before pageshow event.
The behavior probably vary between browsers. I've tested on Chrome 133.0.6943.55.
Expected behavior
After forward/back navigation in user browser the websocket connection should be established.
The text was updated successfully, but these errors were encountered:
mateusz-slab
changed the title
Broken reconnection on browser forward/back navigation
Broken socket reconnection on browser forward/back navigation
Feb 20, 2025
Environment
Actual behavior
We observe that the phoenix websocket connection is not re-established on forward/back navigation in user browser. While there's logic related to forward/back navigation in javascript client it seems to work incorrectly.
The
pageshow
event handler callsthis.connect()
that returns early if there's an active connection -if(this.conn){ return }
.The
pagehide
event is supposed to clear thethis.conn
field by callingthis.disconnect()
that callsthis.teardown
. Unfortunately, the code that actually clears thethis.conn
field is executed asynchronously. As user has already navigated out of the page the the code is not executed beforepageshow
event.The behavior probably vary between browsers. I've tested on Chrome 133.0.6943.55.
Expected behavior
After forward/back navigation in user browser the websocket connection should be established.
The text was updated successfully, but these errors were encountered: