Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface WebSocket

A WebSocket connection that is valid from open to close event

Hierarchy

  • WebSocket

Indexable

[key: string]: any

Arbitrary user data may be attached to this object

Index

Methods

close

cork

  • cork(cb: function): void
  • See HttpResponse.cork

    Parameters

    • cb: function
        • (): void
        • Returns void

    Returns void

end

getBufferedAmount

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

    Returns number

getRemoteAddress

  • getRemoteAddress(): ArrayBuffer
  • Returns the remote IP address

    Returns ArrayBuffer

ping

  • Sends a ping control message. Returns true on success, see WebSocket.send. This helper function correlates to WebSocket::send(message, uWS::OpCode::PING, ...).

    Parameters

    Returns boolean

publish

send

  • send(message: RecognizedString, 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: RecognizedString
    • Optional isBinary: boolean
    • Optional compress: boolean

    Returns boolean

subscribe

unsubscribe

  • Unsubscribe from a topic. Returns true on success, if the WebSocket was subscribed.

    Parameters

    Returns boolean

unsubscribeAll

  • unsubscribeAll(): void
  • Unsubscribe from all topics.

    Returns void

Generated using TypeDoc