vbmithr / ocaml-websocket

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

Expose websocket_cohttp_lwt. #76

Closed SimonJF closed 7 years ago

SimonJF commented 7 years ago

This should address #63.

This commit adds an additional package, websocket.cohttp, which exposes websocket_cohttp_lwt.ml to allow cohttp servers to call Websocket_cohttp_lwt.upgrade_connection to serve websocket connection requests.

The patch also modifies the websocket_cohttp_lwt interface to follow a similar pattern to websocket_lwt and websocket_async. Before, Frame didn't seem to be exposed correctly, meaning that the test worked, but I couldn't find a way to use the API externally.

The upgrade_connection test should now only use externally-available functionality (i.e. no references to Websocket directly). This has allowed me to get this working (via opam pin) with another project which requires this functionality.

(I was a little confused by commit f81c97aef85d60803f1f0b0d18f9a86c5349ddba -- I couldn't seem to get "opam pin" to work with those edits, so I've reverted them here; I'm probably missing something so comments would be appreciated :) )

vbmithr commented 7 years ago

Merged via b67b188b9115d752a5de7931c70fc0e23c506886. Thanks!

vbmithr commented 7 years ago

The things you fixed was opam2 format, should not be used in prod yet. Reverting it is OK especially since opam2 now automatically convert opam1 format.

SimonJF commented 7 years ago

Brilliant, thanks very much!