A question about websocket...I was wondering which ws protocol version is supported by org.immutant/web 2.1.5
as I have a weird behaviour with wscat
, should I look in undertow 1.3.23
?
so 7-8-13 should be supported
@richiardiandrea: it should be easy enough to bump your undertow version among your deps if you need to
@jcrossley3 thanks, I am trying to understand why my connection gets disconnected right away...I will write here if it is something related with undertow
So @jcrossley3 I have a question about this if you have time, it is not clear to me the reason of this behavior:
$ wscat -c <ws://localhost:3000>
connected (press CTRL+C to quit)
disconnected
I even checked Wireshark dumps and it looks like the server is sending a ACK+FIN
right after the handshake completes successfully
have you confirmed that chrome or firefox works?
(I am using sente
's adapter so I am just warning you that there might be many moving parts here)
yes the browsers are working fine
what about the http-kit sente adapter?
it is more for my own curiosity
let me check
sente may be expecting an initial payload or params, and closes when it doesn't see it
with no timeout at all?
mmm I need to check that as well
not if it expects it as part of the connection setup call
but I'm just guessing
https://github.com/ptaoussanis/sente/blob/master/src/taoensso/sente/server_adapters/immutant.clj#L25
there is a :timeout 0
there but I am not sure of what it does
0
means "never timeout": http://immutant.org/documentation/current/apidoc/immutant.web.async.html
so it looks like the immutant side is ok
sente at least sends the client-id as a param on connection: https://github.com/ptaoussanis/sente/blob/master/src/taoensso/sente.cljc#L1007
yeah but that looks like the client side right?
my client is wscat
correct, but I suspect the server side is expecting that, and closing it when it doesn't see it
for this strange test 😄
oh
you might be right I am about to try putting there some more tracing
Mmm with undertow 1.4.0.Final
I see some logs about sessions:
14:11:41.247 [XNIO-1 task-2] DEBUG io.undertow.websockets.core.request - Attempting websocket handshake with io.undertow.websockets.core.protocol.version13.Hybi13Handshake@66969f7c on HttpServerExchange{ GET / request {Connection=[Upgrade], Sec-WebSocket-Version=[13], Sec-WebSocket-Key=[MTMtMTQ3Mzg4NzUwMTIyOA==], Upgrade=[websocket], Sec-WebSocket-Extensions=[permessage-deflate; client_max_window_bits], Host=[localhost:3000]} response {Server=[undertow], Content-Type=[text/html; charset=utf-8]}}
14:11:41.247 [XNIO-1 task-2] DEBUG io.undertow.request - Upgrading request HttpServerExchange{ GET / request {Connection=[Upgrade], Sec-WebSocket-Version=[13], Sec-WebSocket-Key=[MTMtMTQ3Mzg4NzUwMTIyOA==], Upgrade=[websocket], Sec-WebSocket-Extensions=[permessage-deflate; client_max_window_bits], Host=[localhost:3000]} response {Server=[undertow], Content-Type=[text/html; charset=utf-8]}}
but then nothing else, it looks like it does not even hit sente
(that has traces on as I can see them when using a browser...). Digging diggingwith http-kit
it is even more weird:
$ wscat -c <ws://localhost:3000>
error: Error: unexpected server response (200)
>
but it looks like it is returning an html page for some reason...
so just because I might go crazy I am reporting here my findings...
clojure.lang.ExceptionInfo: Client's Ring request doesn't have a client id. Does your server have the necessary keyword Ring middleware (`wrap-params` & `wrap-keyword-params`)? {:ring-req {:remote-addr "127.0.0.1", :params {}, :route-params nil, :headers {"connection" "Upgrade", "host" "localhost:3000", "sec-websocket-extensions" "permessage-deflate; client_max_window_bits", "sec-websocket-key" "MTMtMTQ3Mzg4OTUwMzM1NQ==", "sec-websocket-version" "13", "upgrade" "websocket"}, :async-channel #object[org.httpkit.server.AsyncChannel 0x7490c843 "/127.0.0.1:3000<->/127.0.0.1:42988"], :server-port 3000, :content-length 0, :form-params {}, :websocket? true, :query-params {}, :content-type nil, :character-encoding "utf8", :uri "/chsk", :server-name "localhost", :query-string nil, :body nil, :scheme :http, :request-method :get}}
at clojure.core$ex_info.invokeStatic(core.clj:4724)
at clojure.core$ex_info.invoke(core.clj:4724)
at
[cut]
with wscat -c <ws://localhost:3000/chsk>
note the chsk
at the end 🤦