Websocket.Content_reassemblerSourceContent_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.
val 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