@wailsio/runtime
    Preparing search index...

    Class WailsSocket

    A stream connection. Implements the useful subset of the WebSocket interface, so the same application code works against a real WebSocket in server builds.

    One deliberate divergence from the standard: binaryType defaults to "arraybuffer" rather than "blob", because stream frames are always binary and a Blob would force an extra async hop to read every message. Setting it to "blob" behaves as the standard describes.

    Hierarchy

    Index

    Constructors

    Properties

    binaryType: "arraybuffer" | "blob" = "arraybuffer"
    CLOSED: 3
    CLOSING: 2
    CONNECTING: 0
    extensions: ""
    name: string

    The stream name this connection was opened against.

    onclose: ((ev: CloseEvent) => void) | null = null
    onerror: ((ev: Event) => void) | null = null
    onmessage: ((ev: MessageEvent) => void) | null = null
    onopen: ((ev: Event) => void) | null = null
    OPEN: 1
    protocol: ""

    Always empty: subprotocols and extensions are not negotiated.

    readyState: number = WailsSocket.CONNECTING
    url: string
    CLOSED: 3
    CLOSING: 2
    CONNECTING: 0
    OPEN: 1

    Accessors

    • get bufferedAmount(): number

      Bytes queued by send() that have not yet reached Go.

      Returns number

    Methods

    • The addEventListener() method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.

      MDN Reference

      Parameters

      Returns void

    • Close the connection. Go's handler sees Receive fail and returns.

      Parameters

      • code: number = 1000
      • reason: string = ""

      Returns void

    • The dispatchEvent() method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order.

      MDN Reference

      Parameters

      Returns boolean

    • The removeEventListener() method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target.

      MDN Reference

      Parameters

      Returns void