diff --git a/.gitignore b/.gitignore index 392b865..27614cb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ _build **/*.merlin -*.install \ No newline at end of file +*.install +.vscode \ No newline at end of file diff --git a/async/dune b/async/dune index d2a60fa..af4db41 100644 --- a/async/dune +++ b/async/dune @@ -1,9 +1,9 @@ (library (name websocket_async) - (public_name websocket-async) - (modules websocket_async) - (optional) - (libraries websocket logs-async cohttp-async)) + (public_name websocket-async) + (modules websocket_async) + (optional) + (libraries websocket logs-async cohttp-async)) (executable (name wscat) diff --git a/core/websocket.mli b/core/websocket.mli index 7a25987..ea57c3a 100644 --- a/core/websocket.mli +++ b/core/websocket.mli @@ -21,6 +21,8 @@ val upgrade_present : Cohttp.Header.t -> bool exception Protocol_error of string +val proto_error : ('b, Format.formatter, unit, 'a) format4 -> 'b + module Rng : sig val init : ?state:Random.State.t -> unit -> int -> string (** [init ?state ()] is a function that returns a string of random @@ -40,6 +42,9 @@ module Frame : sig | Nonctrl of int val to_string : t -> string + val to_enum : t -> int + val of_enum : int -> t + val is_ctrl : t -> bool val pp : Format.formatter -> t -> unit end @@ -57,6 +62,7 @@ module Frame : sig t val close : int -> t + val of_bytes : ?opcode:Opcode.t -> ?extension:int -> ?final:bool -> bytes -> t end val check_origin : diff --git a/dune b/dune new file mode 100644 index 0000000..c90464f --- /dev/null +++ b/dune @@ -0,0 +1 @@ +(vendored_dirs ocaml-cohttp) diff --git a/dune-project b/dune-project index 7675e94..4661d43 100644 --- a/dune-project +++ b/dune-project @@ -85,3 +85,28 @@ (websocket (= :version)) (lwt_log (>= 1.1.1)) (cohttp-lwt-unix (>= 5.0.0)))) + +(package + (name websocket-eio) + (synopsis "Websocket library (Eio)") + (description +"\| The WebSocket Protocol enables two-way communication between a client +"\| running untrusted code in a controlled environment to a remote host +"\| that has opted-in to communications from that code. +"\| +"\| The security model used for this is the origin-based security model +"\| commonly used by web browsers. The protocol consists of an opening +"\| handshake followed by basic message framing, layered over TCP. +"\| +"\| The goal of this technology is to provide a mechanism for +"\| browser-based applications that need two-way communication with +"\| servers that does not rely on opening multiple HTTP connections (e.g., +"\| using XMLHttpRequest or