Hierarchy

  • EventEmitter<ConnectionEvents>
    • Connection

Constructors

  • Parameters

    Returns Connection

Properties

#activity: number = ...
#ephemeral: boolean
#ephemeralCheck?: Timeout
#expectAuth: boolean = false
#log: Debugger
ActiveRequests: Set<string> = ...
Address: string
Authed: boolean = false
AwaitingAuth: Map<string, boolean>
ConnectTimeout: number = DefaultConnectTimeout
Down: boolean = true
EventsCallback: Map<string, ((msg) => void)>

Type declaration

    • (msg): void
    • Parameters

      • msg: (string | boolean)[]

      Returns void

HasStateChange: boolean = true
Id: string
Info?: RelayInfo
IsClosed: boolean
PendingRaw: object[] = []
PendingRequests: {
    cb: (() => void);
    cmd: [cmd: "REQ", id: string, ...filters: ReqFilter[]];
}[] = []

Type declaration

  • cb: (() => void)
      • (): void
      • Returns void

  • cmd: [cmd: "REQ", id: string, ...filters: ReqFilter[]]
ReconnectTimer?: Timeout
Settings: RelaySettings
Socket: null | WebSocket = null
Stats: ConnectionStats = ...
prefixed: string | boolean

Accessors

  • get #maxSubscriptions(): number
  • Returns number

  • get Ephemeral(): boolean
  • Returns boolean

  • set Ephemeral(v): void
  • Parameters

    • v: boolean

    Returns void

Methods

  • Returns void

  • Parameters

    • challenge: string

    Returns Promise<void>

  • Returns void

  • Parameters

    • obj: object

    Returns undefined | false

  • Parameters

    • obj: unknown

    Returns boolean

  • Returns void

  • Returns void

  • Returns void

  • Parameters

    • id: string

    Returns void

  • Returns Promise<void>

  • Parameters

    • e: CloseEvent

    Returns void

  • Parameters

    • e: Event

    Returns void

  • Parameters

    • e: MessageEvent

    Returns void

  • Parameters

    • wasReconnect: boolean

    Returns void

  • Queue or send command to the relay

    Parameters

    • cmd: [cmd: "REQ", id: string, ...filters: ReqFilter[]]

      The REQ to send to the server

    • cbSent: (() => void)
        • (): void
        • Returns void

    Returns void

  • Send event on this connection and wait for OK response

    Parameters

    Returns Promise<OkResponse>

  • Send event on this connection

    Parameters

    Returns void

  • Using relay document to determine if this relay supports a feature

    Parameters

    • n: number

    Returns boolean

  • Type Parameters

    • T extends keyof ConnectionEvents

    Parameters

    • event: T
    • fn: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: ArgumentMap<ConnectionEvents>[Extract<T, keyof ConnectionEvents>]

          Returns void

    • Optional context: any

    Returns this

  • Calls each of the listeners registered for a given event.

    Type Parameters

    • T extends keyof ConnectionEvents

    Parameters

    • event: T
    • Rest ...args: ArgumentMap<ConnectionEvents>[Extract<T, keyof ConnectionEvents>]

    Returns boolean

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

    Returns (keyof ConnectionEvents)[]

  • Return the number of listeners listening to a given event.

    Parameters

    • event: keyof ConnectionEvents

    Returns number

  • Return the listeners registered for a given event.

    Type Parameters

    • T extends keyof ConnectionEvents

    Parameters

    • event: T

    Returns ((...args) => void)[]

  • Returns void

  • Type Parameters

    • T extends keyof ConnectionEvents

    Parameters

    • event: T
    • Optional fn: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: ArgumentMap<ConnectionEvents>[Extract<T, keyof ConnectionEvents>]

          Returns void

    • Optional context: any
    • Optional once: boolean

    Returns this

  • Add a listener for a given event.

    Type Parameters

    • T extends keyof ConnectionEvents

    Parameters

    • event: T
    • fn: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: ArgumentMap<ConnectionEvents>[Extract<T, keyof ConnectionEvents>]

          Returns void

    • Optional context: any

    Returns this

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

    Type Parameters

    • T extends keyof ConnectionEvents

    Parameters

    • event: T
    • fn: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: ArgumentMap<ConnectionEvents>[Extract<T, keyof ConnectionEvents>]

          Returns void

    • Optional context: any

    Returns this

  • Remove all listeners, or those of the specified event.

    Parameters

    • Optional event: keyof ConnectionEvents

    Returns this

  • Remove the listeners of a given event.

    Type Parameters

    • T extends keyof ConnectionEvents

    Parameters

    • event: T
    • Optional fn: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: ArgumentMap<ConnectionEvents>[Extract<T, keyof ConnectionEvents>]

          Returns void

    • Optional context: any
    • Optional once: boolean

    Returns this

Generated using TypeDoc