Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface Connection

Interface for sending and receiving messages with a client.

Hierarchy

  • Connection

Implemented by

Index

Properties

promises

promises: Map<Guid, QueuedPromise>

quality

quality: ConnectionQuality

statsReport

statsReport: NetworkStatsReport

A snapshot of this connection's bandwidth usage

Methods

close

  • close(): void

off

  • off(event: "send" | "recv", listener: (message: Message, serializedMessage?: Buffer) => void): void
  • off(event: "close", listener: () => void): void
  • off(event: "error", listener: (err: any) => void): void
  • Unregisters the handler for these events.

    Parameters

    • event: "send" | "recv"
    • listener: (message: Message, serializedMessage?: Buffer) => void
        • (message: Message, serializedMessage?: Buffer): void
        • Parameters

          • message: Message
          • Optional serializedMessage: Buffer

          Returns void

    Returns void

  • Parameters

    • event: "close"
    • listener: () => void
        • (): void
        • Returns void

    Returns void

  • Parameters

    • event: "error"
    • listener: (err: any) => void
        • (err: any): void
        • Parameters

          • err: any

          Returns void

    Returns void

on

  • on(event: "send" | "recv", listener: (message: Message, serializedMessage?: Buffer) => void): void
  • on(event: "close", listener: () => void): void
  • on(event: "error", listener: (err: any) => void): void
  • Registers a handler for the 'send' or 'recv' events. Called when a new message is to be sent.

    Parameters

    • event: "send" | "recv"
    • listener: (message: Message, serializedMessage?: Buffer) => void
        • (message: Message, serializedMessage?: Buffer): void
        • Parameters

          • message: Message
          • Optional serializedMessage: Buffer

          Returns void

    Returns void

  • Registers a handler for the 'close' event. Called when the connection was closed.

    Parameters

    • event: "close"
    • listener: () => void
        • (): void
        • Returns void

    Returns void

  • Registers a handler for the 'error' event. Called when the connection experiences an error.

    Parameters

    • event: "error"
    • listener: (err: any) => void
        • (err: any): void
        • Parameters

          • err: any

          Returns void

    Returns void

recv

  • recv(message: Message, serializedMessage?: Buffer): void

send

  • send(message: Message, serializedMessage?: Buffer): void