Module Brr_io.Websocket
Websocket objects.
See Web Sockets API.
XXX Add a bit of future convenience.
module Binary_type : sig ... endBinary type enum.
module Ready_state : sig ... endReady state enum.
The type for WebSocket objects.
val create : ?protocols:Jv.Jstr.t list -> Jstr.t -> Brr_io.Websocket.tcreate ~protocols url creates a new socket connected to url.
val as_target : Brr_io.Websocket.t -> Brr.Ev.targetas_target s is s as an event target.
val binary_type : Brr_io.Websocket.t -> Brr_io.Websocket.Binary_type.tbinary_type s is the type of binary data received.
val set_binary_type :
Brr_io.Websocket.t ->
Brr_io.Websocket.Binary_type.t ->
unitset_binary_type s t sets the binary_type of s to t.
val close : ?code:int -> ?reason:Jstr.t -> Brr_io.Websocket.t -> unitclose s closes s.
Properties
val url : Brr_io.Websocket.t -> Jstr.turl s is the url of s.
val ready_state : Brr_io.Websocket.t -> Brr_io.Websocket.Ready_state.tready_state s is the state of the connection.
val buffered_amount : Brr_io.Websocket.t -> intbuffered_amount s is the sent buffered amount of s.
val extensions : Brr_io.Websocket.t -> Jstr.textensions s are the extensions selected by the server.
val protocol : Brr_io.Websocket.t -> Jstr.tprotocol s is the protocol selected by the server.
Sending
val send_string : Brr_io.Websocket.t -> Jstr.t -> unitsend_string s d sends the UTF-8 encoding of d on s.
val send_blob : Brr_io.Websocket.t -> Brr.Blob.t -> unitsend_blob s d sends the binary content of d on s.
val send_array_buffer : Brr_io.Websocket.t -> Brr.Tarray.Buffer.t -> unitsend_blob s d sends the binary content of d on s.
val send_tarray : Brr_io.Websocket.t -> ('a, 'b) Brr.Tarray.t -> unitsend_blob s d sends the binary content of d on s.
Events
module Ev : sig ... endWebsocket events.
val to_jv : Brr_io.Websocket.t -> Jv.jvval of_jv : Jv.jv -> Brr_io.Websocket.t