vbmithr / ocaml-websocket

Websocket library for OCaml
ISC License
163 stars 44 forks source link

How to detect closed connection #30

Closed reynir closed 9 years ago

reynir commented 9 years ago

It seems to me there's no way to detect when a connection is closed. On this line the exception Close_frame_received is raised, but the exception is not exported in the .mli. In my testing it seems the exception sometimes is raised twice, and my guess is when 1) the close frame is received, 2) when the underlying socket is closed.

j0sh commented 9 years ago

Here is a workaround until a proper fix is in place: https://github.com/vbmithr/ocaml-websocket/pull/28

Note that LWT_LOG needs to be set. (Why, I don't know...)

vbmithr commented 9 years ago

Strange. I'd like to rewrite all this to make it less dependent on Lwt anyway. I'm a bit scared by all those "strange" bugs to be honest. I'm gonna have a serious look at it soon, sorry for the delay.

vbmithr commented 9 years ago

Fixed in HEAD.