Options
All
  • Public
  • Public/Protected
  • All
Menu

Class SingleConnection

Hierarchy

Index

Constructors

constructor

Properties

Readonly configuration

Readonly connectionID

connectionID: number = connectionIDCounter++

Readonly joinedChannels

joinedChannels: Set<string> = new Set<string>()

Readonly pendingResponses

pendingResponses: ResponseAwaiter[] = []

state

state: ClientState = ClientState.UNCONNECTED

Readonly transport

transport: Transport

Readonly wantedChannels

wantedChannels: Set<string> = new Set<string>()

Static prefixed

prefixed: string | boolean

Accessors

closed

  • get closed(): boolean

connected

  • get connected(): boolean

connecting

  • get connecting(): boolean

ready

  • get ready(): boolean

unconnected

  • get unconnected(): boolean

Methods

addListener

  • addListener<T>(event: T, fn: EventEmitter.EventListener<ClientEvents, T>, context?: Context): this

advanceState

close

  • close(): void

connect

  • connect(): void

destroy

  • destroy(error?: Error): void

emit

  • emit<T>(event: T, ...args: EventEmitter.EventArgs<ClientEvents, T>): boolean
  • Calls each of the listeners registered for a given event.

    Type parameters

    Parameters

    • event: T
    • Rest ...args: EventEmitter.EventArgs<ClientEvents, T>

    Returns boolean

emitClosed

  • emitClosed(error?: Error): void

emitConnected

  • emitConnected(): void

emitConnecting

  • emitConnecting(): void

emitError

  • emitError(error: Error, emitEvenIfClosed?: boolean): void

emitMessage

emitReady

  • emitReady(): void

eventNames

  • Return an array listing the events for which the emitter has registered listeners.

    Returns Array<EventEmitter.EventNames<ClientEvents>>

listenerCount

  • listenerCount(event: EventEmitter.EventNames<ClientEvents>): number
  • Return the number of listeners listening to a given event.

    Parameters

    Returns number

listeners

  • Return the listeners registered for a given event.

    Type parameters

    Parameters

    • event: T

    Returns Array<EventEmitter.EventListener<ClientEvents, T>>

off

  • off<T>(event: T, fn?: EventEmitter.EventListener<ClientEvents, T>, context?: Context, once?: undefined | false | true): this
  • Type parameters

    Parameters

    • event: T
    • Optional fn: EventEmitter.EventListener<ClientEvents, T>
    • Optional context: Context
    • Optional once: undefined | false | true

    Returns this

on

  • Add a listener for a given event.

    Type parameters

    Parameters

    Returns this

onConnect

  • onConnect(): void

once

  • Add a one-time listener for a given event.

    Type parameters

    Parameters

    Returns this

removeAllListeners

  • removeAllListeners(event?: EventEmitter.EventNames<ClientEvents>): this
  • Remove all listeners, or those of the specified event.

    Parameters

    Returns this

removeListener

  • removeListener<T>(event: T, fn?: EventEmitter.EventListener<ClientEvents, T>, context?: Context, once?: undefined | false | true): this
  • Remove the listeners of a given event.

    Type parameters

    Parameters

    • event: T
    • Optional fn: EventEmitter.EventListener<ClientEvents, T>
    • Optional context: Context
    • Optional once: undefined | false | true

    Returns this

sendRaw

  • sendRaw(command: string): void

use

Generated using TypeDoc