jarohen/chord

WebSocket connection to 'ws://localhost:8080/streaming' failed: Invalid frame header

twashing opened this issue · 5 comments

When making a websocket connection to my server, chrod/client.cljs:35 is giving me the error mssage.

WebSocket connection to 'ws://localhost:8080/streaming' failed: Invalid frame header

What does this mean and how can I fix it? Thanks.

Hi there, thanks for reporting :) that's not one I've seen before, I'm afraid - would it be possible to post the code around it on client- and server-side so that I can repro?

Hey James,

I tried to set something up for you. Check out this branch. Ignore the current Usage docs and go to http://localhost:8080/index.html, after running this.

lein repl
=> (require '[beatthemarket.shell :as sh])
=> (require 'cljs.build.api)     ;; compile cljs
=> (cljs.build.api/build "src"
                        {:main 'beatthemarket.client.core
                         :output-to "resources/public/js/main.js"
                         :output-dir "resources/public/js"
                         :asset-path "js"})
=> (sh/start-server)

Are you seeing the same error I'm seeing? And am I just using chord incorrectly?

Thanks

Hey, thanks for sending this through. I've managed to connect to your streaming handler using a Chrome extension (couldn't find index.html?) by changing the app definition to:

(def app
  (handler/site
   (compojure/routes
     (GET "/"           req (index-handler req))
     (GET "/streaming"  req ((wrap-websocket-handler streaming-handler) req))
     (route/resources "/")
     (route/not-found "Page not found"))))

The wrap-websocket-handler call checks whether the incoming request is a websocket upgrade request and, if so, performs the handshake, and puts the ws-channel into the request map.

Could you check whether your client-side app works with this change?

Cheers!

James

Ahh yes, that seems to have done the trick.

Thanks so much James. This helps a lot.

Tim

On Tue, May 10, 2016 at 2:08 PM, James Henderson notifications@github.com
wrote:

Hey, thanks for sending this through. I've managed to connect to your
streaming handler using a Chrome extension (couldn't find index.html?) by
changing the app definition to:

(def app
(handler/site
(compojure/routes
(GET "/" req (index-handler req))
(GET "/streaming" req ((wrap-websocket-handler streaming-handler) req))
(route/resources "/")
(route/not-found "Page not found"))))

The wrap-websocket-handler call checks whether the incoming request is a
websocket upgrade request and, if so, performs the handshake, and puts the
ws-channel into the request map.

Could you check whether your client-side app works with this change?

Cheers!

James


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#49 (comment)

No worries :)