Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

:chsk/state :open? is true when disconnected on page navigation #380

Closed
hoxu opened this issue Oct 1, 2020 · 1 comment
Closed

:chsk/state :open? is true when disconnected on page navigation #380

hoxu opened this issue Oct 1, 2020 · 1 comment

Comments

@hoxu
Copy link
Contributor

hoxu commented Oct 1, 2020

When Firefox navigates to another page and the websocket disconnects, :chks/state is fired, but it erroneously contains :open? true.

From browser console:

09:47:00.232 2020-10-01T06:47:00.230Z DEBUG [taoensso.sente:1230] - Clean WebSocket close, will not attempt reconnect taoensso.timbre.appenders.core.js:158:15
09:47:00.238 !!! :chsk/state  [{:type :ws, :open? true, :ever-opened? true, :csrf-token nil, :uid #uuid "706f5103-4694-4db8-9146-fe53e01901c1", :handshake-data {:app-version dev}, :first-open? true} {:type :ws, :open? true, :ever-opened? true, :csrf-token nil, :uid #uuid "706f5103-4694-4db8-9146-fe53e01901c1", :handshake-data {:app-version dev}, :first-open? false, :last-ws-close {:udt 1601534820230, :ev #object[CloseEvent [object CloseEvent]], :clean? true, :code 1001, :reason }}] cljs.core.js:168:20

new-state-map contains :open? true, even though the connection is closed.

The relevant debug print is called from here:

https://github.com/ptaoussanis/sente/blob/80d9acd64f86ea2288d48a17c94443e1358fd8ab/src/taoensso/sente.cljc#L1226-L1232

Firefox 81.0

@ptaoussanis
Copy link
Member

Thanks for the report! Will be addressed in forthcoming v1.18, apologies for the long delay!

ptaoussanis added a commit that referenced this issue Mar 7, 2023
Includes

  - [fix] [#380] Show correct (false) `:open?` state when Firefox unloading
  - [new] More robust detection of client-unloading state
  - [new] Client `:chsk/state` event now includes a 3rd `open-changed?` element:
      [<old-state-map> <new-state-map> <open-changed?>]
  - [new] Add ChWebSocket socket handle mechanism to ensure that socket events
    from old sockets don't produce noise, or pollute chsk state
ptaoussanis added a commit that referenced this issue Mar 7, 2023
Includes

  - [fix] [#380] Show correct (false) `:open?` state when Firefox unloading
  - [new] More robust detection of client-unloading state
  - [new] Client `:chsk/state` event now includes a 3rd `open-changed?` element:
      [<old-state-map> <new-state-map> <open-changed?>]
  - [new] Add ChWebSocket socket handle mechanism to ensure that socket events
    from old sockets don't produce noise, or pollute chsk state
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants