Options
All
  • Public
  • Public/Protected
  • All
Menu

Class WebSocketProxyServer

Hierarchy

  • Server
    • WebSocketProxyServer

Index

Constructors

constructor

  • new WebSocketProxyServer(options: ServerOptions, callback: undefined | function): WebSocketProxyServer

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: "close" | "listening", cb: function): this
  • addListener(event: string | symbol, listener: function): this
  • Parameters

    • event: "connection"
    • cb: function
        • (client: WebSocket): void
        • Parameters

          • client: WebSocket

          Returns void

    Returns this

  • Parameters

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

          • err: Error

          Returns void

    Returns this

  • Parameters

    • event: "headers"
    • cb: function
        • (headers: string[], request: IncomingMessage): void
        • Parameters

          • headers: string[]
          • request: IncomingMessage

          Returns void

    Returns this

  • Parameters

    • event: "close" | "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

  • address(): AddressInfo | string
  • 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>
  • Returns Array<string | symbol>

getMaxListeners

  • getMaxListeners(): number
  • Returns number

handleUpgrade

  • handleUpgrade(request: IncomingMessage, socket: Socket, upgradeHead: Buffer, callback: function): void
  • Parameters

    • request: IncomingMessage
    • socket: Socket
    • upgradeHead: Buffer
    • callback: function
        • (client: WebSocket): void
        • Parameters

          • client: WebSocket

          Returns void

    Returns void

listenerCount

  • listenerCount(type: string | symbol): number
  • Parameters

    • type: string | symbol

    Returns number

listeners

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

    • event: string | symbol

    Returns Function[]

off

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

    • event: "connection"
    • cb: function
        • (this: Server, socket: WebSocket, request: IncomingMessage): void
        • Parameters

          • this: Server
          • socket: WebSocket
          • request: IncomingMessage

          Returns void

    Returns this

  • Parameters

    • event: "error"
    • cb: function
        • (this: Server, error: Error): void
        • Parameters

          • this: Server
          • error: Error

          Returns void

    Returns this

  • Parameters

    • event: "headers"
    • cb: function
        • (this: Server, headers: string[], request: IncomingMessage): void
        • Parameters

          • this: Server
          • headers: string[]
          • request: IncomingMessage

          Returns void

    Returns this

  • Parameters

    • event: "close" | "listening"
    • cb: function
        • (this: Server): void
        • Parameters

          • this: Server

          Returns void

    Returns this

  • Parameters

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

          • this: Server
          • 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: "close" | "listening", cb: function): this
  • on(event: string | symbol, listener: function): this
  • Parameters

    • event: "connection"
    • cb: function
        • (this: Server, socket: WebSocket, request: IncomingMessage): void
        • Parameters

          • this: Server
          • socket: WebSocket
          • request: IncomingMessage

          Returns void

    Returns this

  • Parameters

    • event: "error"
    • cb: function
        • (this: Server, error: Error): void
        • Parameters

          • this: Server
          • error: Error

          Returns void

    Returns this

  • Parameters

    • event: "headers"
    • cb: function
        • (this: Server, headers: string[], request: IncomingMessage): void
        • Parameters

          • this: Server
          • headers: string[]
          • request: IncomingMessage

          Returns void

    Returns this

  • Parameters

    • event: "close" | "listening"
    • cb: function
        • (this: Server): void
        • Parameters

          • this: Server

          Returns void

    Returns this

  • Parameters

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

          • this: Server
          • Rest args: any[]

          Returns void

    Returns this

once

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

    • event: "connection"
    • cb: function
        • (this: Server, socket: WebSocket, request: IncomingMessage): void
        • Parameters

          • this: Server
          • socket: WebSocket
          • request: IncomingMessage

          Returns void

    Returns this

  • Parameters

    • event: "error"
    • cb: function
        • (this: Server, error: Error): void
        • Parameters

          • this: Server
          • error: Error

          Returns void

    Returns this

  • Parameters

    • event: "headers"
    • cb: function
        • (this: Server, headers: string[], request: IncomingMessage): void
        • Parameters

          • this: Server
          • headers: string[]
          • request: IncomingMessage

          Returns void

    Returns this

  • Parameters

    • event: "close" | "listening"
    • cb: function
        • (this: Server): void
        • Parameters

          • this: Server

          Returns void

    Returns 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
  • Parameters

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

          • Rest args: any[]

          Returns void

    Returns this

prependOnceListener

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

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

          • Rest args: any[]

          Returns void

    Returns this

rawListeners

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

    • event: string | symbol

    Returns Function[]

removeAllListeners

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

    • Optional event: string | symbol

    Returns this

removeListener

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

    • event: "connection"
    • cb: function
        • (client: WebSocket): void
        • Parameters

          • client: WebSocket

          Returns void

    Returns this

  • Parameters

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

          • err: Error

          Returns void

    Returns this

  • Parameters

    • event: "headers"
    • cb: function
        • (headers: string[], request: IncomingMessage): void
        • Parameters

          • headers: string[]
          • request: IncomingMessage

          Returns void

    Returns this

  • Parameters

    • event: "close" | "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

setMaxListeners

  • setMaxListeners(n: number): this
  • Parameters

    • n: number

    Returns this

shouldHandle

  • shouldHandle(request: IncomingMessage): boolean | Promise<boolean>
  • Parameters

    • request: IncomingMessage

    Returns boolean | Promise<boolean>

Static listenerCount

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

    • emitter: EventEmitter
    • event: string | symbol

    Returns number