vbmithr / ocaml-websocket

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

Add tests/examples using secure websockets #44

Open darioteixeira opened 8 years ago

darioteixeira commented 8 years ago

Since ocaml-websocket uses ocaml-conduit, in theory it should support secure (HTTPS) websockets out-of-the-box. In practice, however, I've been unable to get even simple examples to run (see this message). I think a lot of headaches could be spared if such a simple example were shipped with the library (a secure version of the wscat example, for instance).

vbmithr commented 8 years ago

On 02/02/2016 02:26, Dario Teixeira wrote:

Since |ocaml-websocket| uses |ocaml-conduit|, in theory it should support secure (HTTPS) websockets out-of-the-box In practice, however, I've been unable to get even simple examples to run (see this message https://sympainriafr/sympa/arc/caml-list/2016-01/msg00037html) I think a lot of headaches could be spared if such a simple example were shipped with the library (a secure version of the |wscat| example, for instance)

Hey Dario,

I'll have a look. Sorry that it caused you headaches :)

darioteixeira commented 8 years ago

Hey @vbmithr, did you manage to find out the problem with https?

vbmithr commented 8 years ago

I'm using the Async client and have no problem with https. To be honest that's the only thing I need and use. I'll have a look at your message (server issue with TLS right?) today.

darioteixeira commented 8 years ago

The scenario I'm having trouble with consists of an Ocsigen server (running in HTTPS) whose daemon uses OCaml-websocket to listen to HTTPS websockets (using LWT, of course). The clients are regular web browsers. Obviously I don't discount the possibility that I'm doing something dumb somewhere, which is why having an example using secure websockets would be helpful...

vbmithr commented 8 years ago

Are you using @lostman 's upgrade connection feature?

vbmithr commented 8 years ago

@lostman : I believe your use case was pretty similar to @darioteixeira 's one. Did you try https connections/ have any issue with them?

darioteixeira commented 8 years ago

@vbmithr: No. Should I?

darioteixeira commented 8 years ago

Btw, I've tried the current master, and it seems to work now (hurrah!). There is however an exception being raised when the client (the browser) disconnects: Uncommon.Boot.Unseeded_generator. Harmless?

Thank you very much!

vbmithr commented 8 years ago

On 11/04/2016 22:15, Dario Teixeira wrote:

Btw, I've tried the current master https://github.com/vbmithr/ocaml-websocket/commit/293a4b47f3d0181e4bda733047550275d15dff4c, and it seems to work now (hurrah!). There is however an exception being raised when the client (the browser) disconnects: |Uncommon.Boot.Unseeded_generator|. Harmless?

Thank you very much!

For the Unseeded_generator exception, you need to call Nocrypto_entropy_lwt.initialize before using websocket functions. I don't know why it works now though, and did not before…

darioteixeira commented 8 years ago

I don't know why it works now though, and did not before…

I could try a git bisect to narrow down the commit which made it work. Have you managed to replicate the problem on your end?

vbmithr commented 8 years ago

Ok, I had a look, indeed I could not make the Lwt SSL server working, see #50. Did it really worked for you?

darioteixeira commented 8 years ago

With the latest master it does work fine.

XVilka commented 6 years ago

Would be nice to have