UNPKG

@getanthill/datastore

Version:

Event-Sourced Datastore

19 lines (18 loc) 817 B
import type { JSONSchemaType } from 'ajv'; import type { Access, AnyObject } from '../typings'; import MQTT from 'async-mqtt'; import Broker from './broker'; export default class MQTTClient extends Broker { static ERRORS: { NOT_CONNECTED: Error; }; private _client; get client(): MQTT.AsyncMqttClient; connect(): Promise<MQTTClient>; end(): Promise<MQTTClient | undefined>; authenticate(tokens: Access[], handler: Function): (event: any, route: any, headers: any, opts: any) => any; onMessage(topic: string, message: any, packet: any): void; publish(topic: string, payload: any, options?: any): Promise<void>; subscribe(topic: string, schema: JSONSchemaType<AnyObject>): Promise<MQTT.ISubscriptionGrant[]>; next(topic: string, timeout?: number): Promise<string>; }