Fork me on GitHub
#immutant
<
2016-09-14
>
richiardiandrea18:09:43

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 ?

richiardiandrea18:09:06

so 7-8-13 should be supported

jcrossley319:09:22

@richiardiandrea: it should be easy enough to bump your undertow version among your deps if you need to

richiardiandrea19:09:13

@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

richiardiandrea20:09:27

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 
connected (press CTRL+C to quit)
disconnected

richiardiandrea20:09:12

I even checked Wireshark dumps and it looks like the server is sending a ACK+FIN right after the handshake completes successfully

jcrossley320:09:35

have you confirmed that chrome or firefox works?

richiardiandrea20:09:43

(I am using sente's adapter so I am just warning you that there might be many moving parts here)

richiardiandrea20:09:57

yes the browsers are working fine

tcrawley20:09:12

what about the http-kit sente adapter?

richiardiandrea20:09:18

it is more for my own curiosity

tcrawley20:09:48

sente may be expecting an initial payload or params, and closes when it doesn't see it

richiardiandrea20:09:59

with no timeout at all?

richiardiandrea20:09:08

mmm I need to check that as well

tcrawley20:09:17

not if it expects it as part of the connection setup call

tcrawley20:09:20

but I'm just guessing

richiardiandrea20:09:49

there is a :timeout 0 there but I am not sure of what it does

richiardiandrea20:09:30

so it looks like the immutant side is ok

richiardiandrea20:09:35

yeah but that looks like the client side right?

richiardiandrea20:09:44

my client is wscat

tcrawley20:09:54

correct, but I suspect the server side is expecting that, and closing it when it doesn't see it

richiardiandrea20:09:57

for this strange test 😄

richiardiandrea20:09:22

you might be right I am about to try putting there some more tracing

richiardiandrea21:09:11

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 digging

richiardiandrea21:09:30

with http-kit it is even more weird:

$ wscat -c 
error: Error: unexpected server response (200)
>

richiardiandrea21:09:05

but it looks like it is returning an html page for some reason...

richiardiandrea21:09:26

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]

richiardiandrea21:09:48

note the chsk at the end facepalm