Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • EventEmitter
    • Server

Index

Constructors

  • Parameters

    • Optional options: ServerOptions
    • Optional callback: () => void
        • (): void
        • Returns void

    Returns Server

Properties

clients: Set<WebSocket>
options: ServerOptions
path: string

Methods

  • addListener(event: "connection", cb: (client: WebSocket, request: IncomingMessage) => void): Server
  • addListener(event: "error", cb: (err: Error) => void): Server
  • addListener(event: "headers", cb: (headers: string[], request: IncomingMessage) => void): Server
  • addListener(event: "close" | "listening", cb: () => void): Server
  • addListener(event: string | symbol, listener: (...args: any[]) => void): Server
  • Parameters

    • event: "connection"
    • cb: (client: WebSocket, request: IncomingMessage) => void
        • (client: WebSocket, request: IncomingMessage): void
        • Parameters

          Returns void

    Returns Server

  • Parameters

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

          • err: Error

          Returns void

    Returns Server

  • Parameters

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

          • headers: string[]
          • request: IncomingMessage

          Returns void

    Returns Server

  • Parameters

    • event: "close" | "listening"
    • cb: () => void
        • (): void
        • Returns void

    Returns Server

  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns Server

  • close(cb?: (err?: Error) => void): void
  • Parameters

    • Optional cb: (err?: Error) => void
        • (err?: Error): void
        • Parameters

          • Optional err: Error

          Returns void

    Returns void

  • handleUpgrade(request: IncomingMessage, socket: Duplex, upgradeHead: Buffer, callback: (client: WebSocket, request: IncomingMessage) => void): void
  • Parameters

    • request: IncomingMessage
    • socket: Duplex
    • upgradeHead: Buffer
    • callback: (client: WebSocket, request: IncomingMessage) => void
        • (client: WebSocket, request: IncomingMessage): void
        • Parameters

          Returns void

    Returns void

  • off(event: "connection", cb: (this: Server, socket: WebSocket, request: IncomingMessage) => void): Server
  • off(event: "error", cb: (this: Server, error: Error) => void): Server
  • off(event: "headers", cb: (this: Server, headers: string[], request: IncomingMessage) => void): Server
  • off(event: "close" | "listening", cb: (this: Server) => void): Server
  • off(event: string | symbol, listener: (this: Server, ...args: any[]) => void): Server
  • Parameters

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

    Returns Server

  • Parameters

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

          Returns void

    Returns Server

  • Parameters

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

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

          Returns void

    Returns Server

  • Parameters

    • event: "close" | "listening"
    • cb: (this: Server) => void

    Returns Server

  • Parameters

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

          • this: Server
          • Rest ...args: any[]

          Returns void

    Returns Server

  • on(event: "connection", cb: (this: Server, socket: WebSocket, request: IncomingMessage) => void): Server
  • on(event: "error", cb: (this: Server, error: Error) => void): Server
  • on(event: "headers", cb: (this: Server, headers: string[], request: IncomingMessage) => void): Server
  • on(event: "close" | "listening", cb: (this: Server) => void): Server
  • on(event: string | symbol, listener: (this: Server, ...args: any[]) => void): Server
  • Parameters

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

    Returns Server

  • Parameters

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

          Returns void

    Returns Server

  • Parameters

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

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

          Returns void

    Returns Server

  • Parameters

    • event: "close" | "listening"
    • cb: (this: Server) => void

    Returns Server

  • Parameters

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

          • this: Server
          • Rest ...args: any[]

          Returns void

    Returns Server

  • once(event: "connection", cb: (this: Server, socket: WebSocket, request: IncomingMessage) => void): Server
  • once(event: "error", cb: (this: Server, error: Error) => void): Server
  • once(event: "headers", cb: (this: Server, headers: string[], request: IncomingMessage) => void): Server
  • once(event: "close" | "listening", cb: (this: Server) => void): Server
  • once(event: string | symbol, listener: (...args: any[]) => void): Server
  • Parameters

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

    Returns Server

  • Parameters

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

          Returns void

    Returns Server

  • Parameters

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

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

          Returns void

    Returns Server

  • Parameters

    • event: "close" | "listening"
    • cb: (this: Server) => void

    Returns Server

  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns Server

  • removeListener(event: "connection", cb: (client: WebSocket) => void): Server
  • removeListener(event: "error", cb: (err: Error) => void): Server
  • removeListener(event: "headers", cb: (headers: string[], request: IncomingMessage) => void): Server
  • removeListener(event: "close" | "listening", cb: () => void): Server
  • removeListener(event: string | symbol, listener: (...args: any[]) => void): Server
  • Parameters

    Returns Server

  • Parameters

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

          • err: Error

          Returns void

    Returns Server

  • Parameters

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

          • headers: string[]
          • request: IncomingMessage

          Returns void

    Returns Server

  • Parameters

    • event: "close" | "listening"
    • cb: () => void
        • (): void
        • Returns void

    Returns Server

  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns Server

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

    • request: IncomingMessage

    Returns boolean | Promise<boolean>