Options
All
  • Public
  • Public/Protected
  • All
Menu

Class WS2MailBox

Hierarchy

  • EventEmitter
    • WS2MailBox

Index

Constructors

constructor

  • new WS2MailBox(server: object, opts: MailBoxOpts): WS2MailBox

Properties

DEFAULT_ZIP_LENGTH

DEFAULT_ZIP_LENGTH: number

_KP_last_ping_time

_KP_last_ping_time: number = -1

_KP_last_pong_time

_KP_last_pong_time: number = -1

_KPinterval

_KPinterval: any = null

_interval

_interval: any

bufferMsg

bufferMsg: any

closed

closed: boolean = false

connected

connected: boolean = false

curId

curId: number = 0

host

host: Function

id

id: number

interval

interval: number

opts

opts: any

port

port: string

queue

queue: Array<any> = []

requests

requests: object

Type declaration

  • [key: string]: any

socket

socket: any

timeout

timeout: object

Type declaration

  • [key: string]: any

timeoutValue

timeoutValue: number

useZipCompress

useZipCompress: boolean

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

checkKeepAlive

clearCbTimeout

  • clearCbTimeout(mailbox: WS2MailBox, id: number): void

close

  • close(): void

connect

  • connect(tracer: Tracer, cb: function): void

doSend

  • doSend(socket: any, dataObj: Object): void

emit

  • emit(event: string | symbol, ...args: any[]): boolean
  • Parameters

    • event: string | symbol
    • Rest ...args: any[]

    Returns boolean

enqueue

eventNames

  • eventNames(): Array<string | symbol>
  • Returns Array<string | symbol>

flush

getMaxListeners

  • getMaxListeners(): number
  • Returns number

listenerCount

  • listenerCount(type: string | symbol): number
  • Parameters

    • type: string | symbol

    Returns number

listeners

  • listeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

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

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

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

processMsg

  • processMsg(mailbox: WS2MailBox, pkg: MailBoxPkg): void

processMsgs

  • processMsgs(mailbox: WS2MailBox, pkgs: Array<MailBoxPkg>): void

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

send

  • send(tracer: Tracer, msg: Msg, opts: MailBoxOpts, cb: function): void
  • send message to remote server

    Parameters

    • tracer: Tracer
    • msg: Msg
    • opts: MailBoxOpts

      attach info to send method

    • cb: function

      declaration decided by remote interface

        • (tracer: Tracer, msg?: any, cb?: Function): void
        • Parameters

          • tracer: Tracer
          • Optional msg: any
          • Optional cb: Function

          Returns void

    Returns void

setCbTimeout

  • setCbTimeout(mailbox: WS2MailBox, id: number): void

setMaxListeners

  • setMaxListeners(n: number): this
  • Parameters

    • n: number

    Returns this

Static listenerCount

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

    • emitter: EventEmitter
    • event: string | symbol

    Returns number