vbmithr/ocaml-websocket — pull request #20 by SGrondin (2014-11-20 05:13:27+00:00)
Title: Fixed writer error

Alright,

I'm still kinda new to OCaml, but I hope I'll be able to save you some time. I wrote this little program to test your library with Cohttp 0.12.0 and my fix to your version 0.9.

```ocaml
open Core.Std
open Lwt
open Websocket

try_lwt (
Tls_lwt.rng_init ()
>>= fun () ->
let () = print_endline "abc" in
return ()
>>= fun () ->
let () = print_endline "def" in
Websocket.open_connection (Uri.of_string "http://127.0.0.1:4000")
>>= fun (stream, push) ->
let () = print_endline "ghi" in
return ()
) with
| End_of_file -> return (print_endline "eof!!")
| x -> Exn.to_string x |> fun s -> s^"!!!!!" |> print_endline |> return
```

When connecting to a simple socket.io server, it crashes right away with End_of_file and never prints "ghi" (yes, I'm using blocking print statements intentionally for this test). Maybe there's a bug in my test, but if there isn't, then I hope this will help you narrow it down!

Thanks!