classdom::HttpSocket

sys::Obj
  dom::HttpSocket

@Js

HttpSocket implements an async WebSocket client

close

Source

This close()

Close the web socket.

onClose

Source

Void onClose(|Event f)

Event fired when the web socket is closed

onError

Source

Void onError(|Event f)

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

onOpen

Source

Void onOpen(|Event f)

Event fired when the web socket is opened

onReceive

Source

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

Source

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

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

send

Source

This send(Obj data)

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

uri

Source

Uri uri()

Uri passed to the open method