package async_websocket

  1. Overview
  2. Docs

Module Websocket.Content_reassemblerSource

Content_reassembler can process fragmented content from websocket frames and reassemble fragmented content into a contiguous buffer.

It maintains an internal buffer which is reused to avoid allocs (most of the time). The internal buffer doubles in size whenever needed to avoid quadratic operations.

This can be used together with Frame.Frame_reader to implement the reader side of a websocket connection.

Sourcetype t
Sourceval create : content_handler:((Core.read, Iobuf.no_seek) Iobuf.t -> unit) -> ping_handler:(content:(Core.read, Iobuf.no_seek) Iobuf.t -> unit) -> close_handler: (code:Connection_close_reason.t -> reason:string -> partial_content:string option -> unit) -> protocol_error_handler: (reason:string -> partial_content:string option -> frame:Frame.t option -> unit) -> ?initial_buffer_size:int -> unit -> t
Sourceval process_frame : t -> opcode:Opcode.t -> final:bool -> content:(Core.read, Iobuf.no_seek) Iobuf.t -> unit
Sourceval partial_content_string : t -> string option

partial_content_string yields the content of the contents of the most recent (yet unfinished) message, if there is any content.

OCaml

Innovation. Community. Security.