taoensso / sente

Realtime web comms library for Clojure/Script
https://www.taoensso.com/sente
Eclipse Public License 1.0
1.74k stars 193 forks source link

Handshake fails in Firefox 35 #99

Closed ul closed 9 years ago

ul commented 9 years ago

Unpacked message is different from one in Chrome (where everything works fine):

"Unpacking: -e[:chsk/handshake [:taoensso.sente/nil-uid "W5ixCKNCEZjO5gq33uCDhGgSOPbUdHVuaIw+ewz8wfjDQyZaVNoi+AG0cHC8QI0XiA3AUE3yuVxicrhy"]] -> [[:chsk/handshake [:taoensso.sente/nil-uid "W5ixCKNCEZjO5gq33uCDhGgSOPbUdHVuaIw+ewz8wfjDQyZaVNoi+AG0cHC8QI0XiA3AUE3yuVxicrhy"]] nil]" c6f4dce0-0384-11e4-9191-0800200c9a66.js:2393
"handle-when-handshake!: [:chsk/handshake [:taoensso.sente/nil-uid "W5ixCKNCEZjO5gq33uCDhGgSOPbUdHVuaIw+ewz8wfjDQyZaVNoi+AG0cHC8QI0XiA3AUE3yuVxicrhy"]]" c6f4dce0-0384-11e4-9191-0800200c9a66.js:2393

Browser: https://aboutmybrowser.com/JfrwL0EN

ptaoussanis commented 9 years ago

So to confirm:

Could you also get me a little more context (console output, etc.)? What is the actual error you're seeing?

ul commented 9 years ago

In browser console I see no error, but after handshake no :chsk/state message arrives (my app init waits for it as a signal that WS connection is established and ready) . With encore logging set to :trace I see handshake log that I posted above.

In server log:

2015-янв-27 15:18:24 +0300 cybercraft TRACE [taoensso.sente] - New WebSocket channel: :taoensso.sente/nil-uid (/127.0.0.1:3000<->/127.0.0.1:40350)
2015-янв-27 15:18:24 +0300 cybercraft TRACE [taoensso.sente] - Handshake!
2015-янв-27 15:18:24 +0300 cybercraft TRACE [taoensso.sente] - Packing: (#<FlexiPacker taoensso.sente.packers.transit.FlexiPacker@7dff718c> nil [:chsk
/handshake [:taoensso.sente/nil-uid "yZz3y0jBUKQU6DyroiS7IR1f8nq5T+Sx7B41CrKuTtSHliLEPKKk5kXcD5aO3CeLdlN2DcrIXKsJOhGG"]]) -> -e[:chsk/handshake [:taoe
nsso.sente/nil-uid "yZz3y0jBUKQU6DyroiS7IR1f8nq5T+Sx7B41CrKuTtSHliLEPKKk5kXcD5aO3CeLdlN2DcrIXKsJOhGG"]]
2015-янв-27 15:18:27 +0300 cybercraft TRACE [taoensso.sente] - Unpacking: +e[[:chsk/ws-ping]] -> [[:chsk/ws-ping] nil]
2015-янв-27 15:18:49 +0300 cybercraft TRACE [taoensso.sente] - Unpacking: +e[[:chsk/ws-ping]] -> [[:chsk/ws-ping] nil]

For comparison, when I load page from Chrome, server log looks like:

2015-янв-27 15:25:10 +0300 cybercraft TRACE [taoensso.sente] - New WebSocket channel: b87a4ba9-637d-4833-953b-de342aa56f5c (/127.0.0.1:3000<->/127.0.0
.1:40467)
2015-янв-27 15:25:10 +0300 cybercraft TRACE [taoensso.sente] - Handshake!
2015-янв-27 15:25:10 +0300 cybercraft TRACE [taoensso.sente] - Packing: (#<FlexiPacker taoensso.sente.packers.transit.FlexiPacker@1fe6c6a> nil [:chsk/
handshake ["b87a4ba9-637d-4833-953b-de342aa56f5c" "bOHJ5Ilr9prdQVs625SFYhe+HNv4kKRpAIUsGiPx8Ny/vcHpzcR6mhKQSWyFt7KQykeSRzKoq4lthf7m"]]) -> -e[:chsk/ha
ndshake ["b87a4ba9-637d-4833-953b-de342aa56f5c" "bOHJ5Ilr9prdQVs625SFYhe+HNv4kKRpAIUsGiPx8Ny/vcHpzcR6mhKQSWyFt7KQykeSRzKoq4lthf7m"]]

and my client receive :chsk/state {:first-open? true ...} normally.

ptaoussanis commented 9 years ago

Hi Ruslan, sorry for taking so long to get back to you about this - have had very little free time recently.

Will be taking a look at this in the next few hours. In the meantime: no further updates on your end, right?

ul commented 9 years ago

No :chsk/state {:first-open? true ...} message received by client in Firefox after connection was established.

ptaoussanis commented 9 years ago

Okay, thanks. Downloading FF 35 now.

ptaoussanis commented 9 years ago

Okay, I'm having trouble reproducing a handshake problem on my end.

With Firefox 35.0.1(https://aboutmybrowser.com/nzxCVnm6), Sente 1.3.0 and Encore 1.20.1: I'm running the example-project (version 1.3.0).

Client-side log: WebSocket connection

"ClojureScript appears to have loaded correctly." main.js:46051
"Event: [:chsk/state {:type :ws, :open? true, :destroyed? false, :uid :taoensso.sente/nil-uid, :csrf-token "BADDue+4MksZ1IlQOGYwWUO5rG8B3yELn6boa8Js4eQoCEHCfMiFWjdXjLhwt5fuBhWMcCeAmanx+lFj", :first-open? true}]" main.js:46051
"Channel socket state change: {:type :ws, :open? true, :destroyed? false, :uid :taoensso.sente/nil-uid, :csrf-token "BADDue+4MksZ1IlQOGYwWUO5rG8B3yELn6boa8Js4eQoCEHCfMiFWjdXjLhwt5fuBhWMcCeAmanx+lFj", :first-open? true}"

Client-side log: Ajax connection

"ClojureScript appears to have loaded correctly." main.js:46051
"Event: [:chsk/state {:type :ajax, :open? true, :destroyed? false, :uid :taoensso.sente/nil-uid, :csrf-token "BADDue+4MksZ1IlQOGYwWUO5rG8B3yELn6boa8Js4eQoCEHCfMiFWjdXjLhwt5fuBhWMcCeAmanx+lFj", :first-open? true}]" main.js:46051
"Channel socket state change: {:type :ajax, :open? true, :destroyed? false, :uid :taoensso.sente/nil-uid, :csrf-token "BADDue+4MksZ1IlQOGYwWUO5rG8B3yELn6boa8Js4eQoCEHCfMiFWjdXjLhwt5fuBhWMcCeAmanx+lFj", :first-open? true}"

So both Ajax and WebSocket connections appear to be working correctly on my side: callbacks are operating as usual, broadcasts are operating as usual. Behaviour between Firefox and Chrome seems consistent here.

Some ideas:

  1. Do you see the same (faulty) behaviour with the reference example (v1.3.0), or only with your own project?
  2. Have you tried lein clean / clearing all your target dirs (both Clojure and ClojureScript)?

If you're seeing the same (faulty) behaviour with the reference example even after clearing out your target dirs, then the cause may be something in your environment that we need to track down.

If you're not seeing the same (faulty) behaviour with the ref example and only in your own project, then we can probably rule out Sente - it may be that you're calling a Chrome-only JS extension that's killing your code execution in FF for example. I could try take a look if you could try get me a minimal reproducible example.

ul commented 9 years ago

During time passed from my initial post I migrated my project to boot, and had minor browser update by my package manager. Now I can't reproduce my own issue, which was stable on moment of posting. Excuse me for the noise, I think it was something with stale lein cache or specifical FF build bug.

Thank you for your time and Sente — it is great!

ptaoussanis commented 9 years ago

No problem, thanks for letting me know. Feel free to ping me if the issue ever pops up again and a lein clean doesn't help.

Cheers! :-)