File tree Expand file tree Collapse file tree 2 files changed +27
-1
lines changed
Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,9 @@ let%expect_test "header operations" =
2828 [% expect {| () | }];
2929 printf ! " %{sexp: bool}" (Headers. mem headers " FOO" );
3030 [% expect {| true | }];
31- printf ! " %{sexp: Headers.t}" (Headers. replace headers ~key: " foo" ~data: " THIS IS A NEW KEY" );
31+ printf
32+ ! " %{sexp: Headers.t}"
33+ (Headers. replace headers ~key: " foo" ~data: " THIS IS A NEW KEY" );
3234 [% expect {| ((foo " THIS IS A NEW KEY" ) (hello world)) | }]
3335;;
3436
Original file line number Diff line number Diff line change @@ -2,6 +2,23 @@ open! Core
22open ! Async
33
44module Config : sig
5+ (* Configuration for how to negotiate a websocket connection.
6+
7+ - [buffer_size] controls the initial buffer size for the underlying reader/writer
8+ pair that are handed off to async_websocket. The default is 16_000 bytes.
9+
10+ - [error_handler] is a user provided handler that will be called if the websocket
11+ function encounters an invalid upgrade request.
12+
13+ - [response_headers] any headers that should be sent with the successful
14+ Switching-Protocol response sent to the client.
15+
16+ - [opcode] specifies whether to use Text of Binary frames on the websocket
17+ connection.
18+
19+ - [subprotocol] If a client sends a list of subprotocols this function is called to
20+ check which subprotocol is selected by the server. Reply with None to indicate a null
21+ subprotocol. *)
522 type t
623
724 val create
@@ -16,6 +33,13 @@ module Config : sig
1633 val default : t
1734end
1835
36+ (* * [create] accepts a user provided websocket-handler and performs an HTTP/1.1
37+ protocol upgrade. [create] returns a {{!Shuttle_http.Response.t} http response}
38+ that either represents an error indicating a bad upgrade request,
39+ or contains a `Switching-Protocol` response with an HTTP protocol upgrade handler.
40+ If the protocol negotiation succeeds the user provided websocket handler
41+ will be called with a websocket descriptor. Once the deferred returned by the websocket-handler is resolved,
42+ or if there are any unhandled exceptions in the handler the underlying TCP connection is closed. *)
1943val create
2044 : ?config:Config. t
2145 -> (Websocket. t -> unit Deferred. t)
You can’t perform that action at this time.
0 commit comments