Websocket library for use with cohttp and async
val create : ?force_ssl_overriding_SNI_hostname:string -> ?headers:Header.t -> Uri.t -> (Cohttp_async.Response.t * string Async.Pipe.Reader.t * string Async.Pipe.Writer.t) Async.Deferred.Or_error.t

create endpoint creates a websocket client connected to endpoint. In order to close the connection, close the writer pipe.

force_ssl_overriding_SNI_hostname will unconditionally cause create to use TLS/SSL, and will send its value as the SNI hostname.

val with_websocket_client : ?headers:Header.t -> Uri.t -> f: ( Cohttp_async.Response.t -> string Async.Pipe.Reader.t -> string Async.Pipe.Writer.t -> 'a Async.Deferred.t ) -> 'a Async.Deferred.Or_error.t

with_websocket_client uri ~f applies f to the result of create uri, and closes the connection once the result of f becomes determined.