Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

Index

Constructors

constructor

  • Parameters

    • Optional options: ServerOptions
    • Optional callback: undefined | function

    Returns Server

Properties

clients

clients: Set<WebSocket>

options

options: ServerOptions

path

path: string

Static defaultMaxListeners

defaultMaxListeners: number

Methods

addListener

  • addListener(event: "connection", cb: function): this
  • addListener(event: "error", cb: function): this
  • addListener(event: "headers", cb: function): this
  • addListener(event: "listening", cb: function): this
  • addListener(event: string | symbol, listener: function): this
  • Parameters

    • event: "connection"
    • cb: function

    Returns this

  • Parameters

    • event: "error"
    • cb: function
        • (err: Error): void
        • Parameters

          • err: Error

          Returns void

    Returns this

  • Parameters

    • event: "headers"
    • cb: function

    Returns this

  • Parameters

    • event: "listening"
    • cb: function
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

address

  • Returns AddressInfo | string

close

  • close(cb?: undefined | function): void
  • Parameters

    • Optional cb: undefined | function

    Returns void

emit

  • emit(event: string | symbol, ...args: any[]): boolean
  • Parameters

    • event: string | symbol
    • Rest ...args: any[]

    Returns boolean

eventNames

  • eventNames(): Array<string | symbol>

getMaxListeners

  • getMaxListeners(): number

handleUpgrade

listenerCount

  • listenerCount(type: string | symbol): number

listeners

  • listeners(event: string | symbol): Function[]

off

  • off(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

on

  • on(event: "connection", cb: function): this
  • on(event: "error", cb: function): this
  • on(event: "headers", cb: function): this
  • on(event: "listening", cb: function): this
  • on(event: string | symbol, listener: function): this
  • Parameters

    Returns this

  • Parameters

    • event: "error"
    • cb: function
        • Parameters

          Returns void

    Returns this

  • Parameters

    Returns this

  • Parameters

    • event: "listening"
    • cb: function

    Returns this

  • Parameters

    • event: string | symbol
    • listener: function
        • Parameters

          Returns void

    Returns this

once

  • once(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

prependListener

  • prependListener(event: string | symbol, listener: function): this

prependOnceListener

  • prependOnceListener(event: string | symbol, listener: function): this

rawListeners

  • rawListeners(event: string | symbol): Function[]

removeAllListeners

  • removeAllListeners(event?: string | symbol): this

removeListener

  • removeListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

setMaxListeners

  • setMaxListeners(n: number): this

shouldHandle

  • Parameters

    Returns boolean

Static listenerCount

  • listenerCount(emitter: EventEmitter, event: string | symbol): number
  • deprecated

    since v4.0.0

    Parameters

    Returns number

Generated using TypeDoc