class

HttpSocket

@Js
class HttpSocket : Obj

HttpSocket implements an async WebSocket client

methods onClose

Event fired when the web socket is closed

onError

Event fired when the web socket is closed due to an error

onOpen

Event fired when the web socket is opened

onReceive

Event fired when the web socket receives a message

close

Close the web socket

send

Send the data as a message - data must be a Str or in-memory Buf

uri

Uri passed to the open method

open

Open a web socket to given URI with sub-protocol list

close This close()

Close the web socket.

onClose Void onClose(|Event| f)

Event fired when the web socket is closed

onError Void onError(|Event| f)

Event fired when the web socket is closed due to an error

onOpen Void onOpen(|Event| f)

Event fired when the web socket is opened

onReceive Void onReceive(|Event| f)

Event fired when the web socket receives a message. The message payload is available as a Str or Buf via Event.data

open static HttpSocket open(Uri uri, Str[]? protocols)

Open a web socket to given URI with sub-protocol list

send This send(Obj data)

Send the data as a message - data must be a Str or in-memory Buf

uri Uri uri()

Uri passed to the open method

Haxall 4.0.5 ∙ 24-Feb-2026 14:33 EST