Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ServerMqtt

Hierarchy

Implements

Index

Constructors

constructor

  • new ServerMqtt(options: MqttOptions["options"]): ServerMqtt

Properties

Protected deserializer

deserializer: ConsumerDeserializer

Protected Readonly logger

logger: Logger = new Logger(Server.name)

Protected Readonly messageHandlers

messageHandlers: Map<string, MessageHandler<any, any, any>> = new Map<string, MessageHandler>()

Private mqttClient

mqttClient: MqttClient

Private Readonly options

options: MqttOptions["options"]

Protected serializer

serializer: ConsumerSerializer

Readonly transportId

transportId: MQTT = Transport.MQTT

Private Readonly url

url: string

Methods

addHandler

  • addHandler(pattern: any, callback: MessageHandler, isEventHandler?: boolean): void

bindEvents

close

  • close(): void

createMqttClient

getHandlerByPattern

getHandlers

getMessageHandler

getOptionsProp

  • getOptionsProp<T, K>(obj: T, prop: K, defaultValue?: T[K]): T[K]

getPublisher

  • getPublisher(client: MqttClient, pattern: any, id: string): any

getReplyPattern

  • getReplyPattern(pattern: string): string

getRequestPattern

  • getRequestPattern(pattern: string): string

Protected getRouteFromPattern

  • getRouteFromPattern(pattern: string): string

handleError

  • handleError(stream: any): void

handleEvent

handleMessage

  • handleMessage(channel: string, buffer: Buffer, pub: MqttClient, originalPacket?: Record<string, any>): Promise<any>

Protected initializeDeserializer

  • initializeDeserializer(options: ClientOptions["options"]): void

Protected initializeSerializer

  • initializeSerializer(options: ClientOptions["options"]): void

listen

  • listen(callback: () => void): Promise<void>

Protected loadPackage

  • loadPackage<T>(name: string, ctx: string, loader?: Function): T

matchMqttPattern

  • matchMqttPattern(pattern: string, topic: string): boolean

Protected normalizePattern

  • normalizePattern(pattern: MsPattern): string

parseMessage

send

  • send(stream$: Observable<any>, respond: (data: WritePacket) => void): Subscription

start

  • start(callback?: () => void): void

transformToObservable

  • transformToObservable<T>(resultOrDeferred: any): Observable<T>

Generated using TypeDoc