Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Client

Attaches the ClientProxy instance to the given property

see

https://github.com/nats-io/node-nats

Hierarchy

  • EventEmitter
    • Client

Callable

Index

Constructors

constructor

  • new Client(options?: EventEmitterOptions): Client
  • Parameters

    • Optional options: EventEmitterOptions

    Returns Client

Properties

Static defaultMaxListeners

defaultMaxListeners: number

Static Readonly errorMonitor

errorMonitor: unique symbol

This symbol shall be used to install a listener for only monitoring 'error' events. Listeners installed using this symbol are called before the regular 'error' listeners are called.

Installing a listener using this symbol does not change the behavior once an 'error' event is emitted, therefore the process will still crash if no regular 'error' listener is installed.

Methods

addListener

  • addListener(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns this

close

  • close(): void

createInbox

  • createInbox(): string

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>

flush

getMaxListeners

  • getMaxListeners(): number

listenerCount

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

    • event: string | symbol

    Returns number

listeners

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

    • event: string | symbol

    Returns Function[]

numSubscriptions

  • numSubscriptions(): number

off

  • off(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns this

on

  • on(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns this

once

  • once(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns this

prependListener

  • prependListener(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns this

prependOnceListener

  • prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns this

publish

  • publish(callback: Function): void
  • publish(subject: string, callback: Function): void
  • publish(subject: string, msg: string | Buffer, callback: Function): void
  • publish(subject: string, msg?: string | Buffer, reply?: string, callback?: Function): void

rawListeners

  • rawListeners(event: string | symbol): Function[]

removeAllListeners

  • removeAllListeners(event?: string | symbol): this
  • Parameters

    • Optional event: string | symbol

    Returns this

removeListener

  • removeListener(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns this

request

  • request(subject: string, callback: Function): number
  • request(subject: string, msg: string | Buffer, callback: Function): number
  • request(subject: string, msg?: string, options?: any, callback?: Function): number

requestOne

  • requestOne(subject: string, msg: string | Buffer, options?: any, timeout?: number, callback?: Function): number
  • Publish a message with an implicit inbox listener as the reply. Message is optional. This should be treated as a subscription. Request one, will terminate the subscription after the first response is received or the timeout is reached. The callback can be called with either a message payload or a NatsError to indicate a timeout has been reached. The Subscriber Id is returned.

    Parameters

    • subject: string
    • msg: string | Buffer
    • Optional options: any
    • Optional timeout: number
    • Optional callback: Function

    Returns number

setMaxListeners

  • setMaxListeners(n: number): this
  • Parameters

    • n: number

    Returns this

subscribe

  • subscribe(subject: string, callback: Function): number
  • subscribe(subject: string, opts: any, callback: Function): number

timeout

  • timeout(sid: number, timeout: number, expected: number, callback: (sid: number) => void): void

unsubscribe

  • unsubscribe(sid: number, max?: number): void

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