Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Client

Hierarchy

  • EventEmitter
    • Client

Index

Constructors

constructor

Properties

Private channels

channels: object

Type declaration

connectionState

connectionState: ConnectionState

containerState

containerState: State | null

Private debug

debug: DebugFunc

Private deferredReady

deferredReady: Deferred<void> | null

Private didConnect

didConnect: boolean

Private token

token: string | null

Private ws

ws: WebSocket | EIOCompat | null

Static defaultMaxListeners

defaultMaxListeners: number

Methods

addListener

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

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

          • Rest ...args: any[]

          Returns void

    Returns this

close

  • close(): void
  • Closes the socket connection and handles cleanup

    Returns void

connect

  • connect(options: object): Promise<void>
  • Connects to the server and primes the client to start sending data

    Parameters

    • options: object
      • Optional polling?: undefined | false | true
      • Optional timeout?: undefined | number
      • token: string
      • Optional urlOptions?: UrlOptions

    Returns Promise<void>

    it returns a promise that is resolved when the server is ready (sends cotainer state)

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>

getChannel

getMaxListeners

  • getMaxListeners(): number
  • Returns number

getToken

  • getToken(): string | null

Private handleCloseChannel

  • handleCloseChannel(__namedParameters: object): void

Private handleOpenChanRes

  • handleOpenChanRes(channel: Channel, __namedParameters: object): void

isConnected

  • isConnected(): boolean

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: string | symbol, listener: function): this
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns this

on

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

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

          • Rest ...args: any[]

          Returns void

    Returns this

Private onClose

  • onClose(__namedParameters: object): void
  • Parameters

    • __namedParameters: object
      • closeEvent: undefined | CloseEvent
      • expected: boolean

    Returns void

Private onSocketClose

  • onSocketClose(closeEvent: CloseEvent): void

Private onSocketMessage

  • onSocketMessage(__namedParameters: object): void
  • Parameters

    • __namedParameters: object
      • data: any

    Returns void

once

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

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

          • Rest ...args: any[]

          Returns void

    Returns this

openChannel

  • openChannel(__namedParameters: object): Channel

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: string | symbol, listener: function): this
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns this

Private send

setMaxListeners

  • setMaxListeners(n: number): this
  • Parameters

    • n: number

    Returns this

Private startPing

  • startPing(): void

Private tryConnect

  • tryConnect(__namedParameters: object): Promise<void>
  • Parameters

    • __namedParameters: object
      • polling: undefined | false | true
      • timeout: undefined | number
      • token: string
      • urlOptions: undefined | UrlOptions

    Returns Promise<void>

Static getConnectionStr

  • getConnectionStr(token: string, urlOptions?: UrlOptions): string

Static listenerCount

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

    since v4.0.0

    Parameters

    • emitter: EventEmitter
    • event: string | symbol

    Returns number

Generated using TypeDoc