Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface WebSocket

A WebSocket connection that is valid from open to close event

Hierarchy

  • WebSocket

Index

Methods

close

  • Forefully closes this WebSocket. Immediately calls close handler.

    Returns WebSocket

end

  • end(code: number, shortMessage: string | ArrayBuffer): WebSocket
  • Gradefully closes this WebSocket. Immediately calls close handler.

    Parameters

    • code: number
    • shortMessage: string | ArrayBuffer

    Returns WebSocket

getBufferedAmount

  • getBufferedAmount(): number
  • Returns the bytes buffered in backpressure.

    Returns number

publish

  • publish(topic: string | ArrayBuffer, message: string | ArrayBuffer): WebSocket
  • Publish a message to a topic in MQTT syntax

    Parameters

    • topic: string | ArrayBuffer
    • message: string | ArrayBuffer

    Returns WebSocket

send

  • send(message: string | ArrayBuffer, isBinary: boolean, compress: boolean): boolean
  • Sends a message. Make sure to check getBufferedAmount() before sending. Returns true for success, false for built up backpressure that will drain when time is given.

    Parameters

    • message: string | ArrayBuffer
    • isBinary: boolean
    • compress: boolean

    Returns boolean

subscribe

  • subscribe(topic: string | ArrayBuffer): WebSocket
  • Subscribe to a topic in MQTT syntax

    Parameters

    • topic: string | ArrayBuffer

    Returns WebSocket

unsubscribe

  • unsubscribe(topic: string | ArrayBuffer): WebSocket
  • Unsubscribe from topic (not implemented yet)

    Parameters

    • topic: string | ArrayBuffer

    Returns WebSocket

Generated using TypeDoc