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
WebSocket reserved bits error #95
Comments
It seems that your client try to use some http-kit does not implement extension yet. Is the error message report by Chrome? Any steps to reproduce it? |
Hey @shenfeng, I'm on this problem too. It seems to happen sporadically. Could it have something to do with the way we're initializing the socket? (defn init-socket []
(.log js/console "Initializing socket.")
(reset! ws (let [socket (js/WebSocket. ws-url)]
(set! (.-onmessage socket)
(fn [msg]
(put! receive msg)))
(set! (.-onopen socket)
(fn [_]
(.log js/console "Websocket connected.")))
socket))) I'm worried about a race condition with us swapping out the onmessage, onopen functions like this. Is this the proper way to do things? |
websocket works in the following steps:
Is there any chance that a message is sent to server before Hi, @sritchie looking at the code, the |
It's Chrome we're talking about... I'll keep an eye out for the error. It may be that we were screwing up websocket support in Heroku. |
Hi @shenfeng , thanks for the quick update. We are using Chrome-- the client seems to initialize the websocket fine and begins to receive messages OK. However, when there is a somewhat lengthly pause in messages (around a minute), we can see the 'reserved bits' error in the browser. We're still digging.... |
Hi,
when pause, does http-kit respond any further request? Does http-kit failed? You can try to dump the jvm stack by using |
Hey @shenfeng, we'll do some more research this coming week. We've been sending a keep-alive ping from the client to the server every thirty seconds, but Heroku has a 55 second hard limit on connections, and I'm worried that what's happening is that Heroku is shutting down the websocket connection and we're getting back a response from the heroku load balancer that doesn't match the websocket protocol. |
@sritchie Did you resolve this? Having the same problem on heroku, sending a ping to the server from my javascript client to keep alive. Doesn't happen locally (outside of Heroku). |
@choppen5 we haven't had time to look into it yet, unfortunately. You've got the websockets labs enabled, right? https://devcenter.heroku.com/articles/heroku-labs-websockets Our issue was still happening with that all configured... just want to make sure that we're both set up the same way. |
You can get this error in Chrome if unframed data comes after the handshake, which is then followed by framed data. I just wanted to share that since I just debugged this exact issue for several hours. The implementation I started with was adding the accept string after the CRLF \ CRLF following the headers. |
I sheepishly encountered this when I accidentally applied the handler to the request multiple times within my middleware: (def app
(-> app-routes
((fn [handler]
(fn [request]
(when ...
(handler request))
(handler request)))))) @mondain's comment is what compelled me to look for such a thing. |
Hi there, is anyone still having problems with this or can the issue be closed? |
We're past this issue, but we had actually solved it by moving off of Heroku, so I'm not sure this gives you much signal :) |
@sritchie Okay, thanks for the confirmation Sam! |
Closing this issue for inactivity, please feel free to reopen if anyone has new info/thoughts to contribute. |
Hi,
I am using http-kit 2.1.13 for our app running on Heroku. We make use of websockets to deliver data from server to client, with Carmine.
It works most of the time, but we occasionally get the following error about reserved bits:
Any ideas what could be causing this?
The text was updated successfully, but these errors were encountered: