Skip to main content

Class: ClientMethodHandler

The MethodHandler which sends the commands to the Rust side.

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new ClientMethodHandler(options)

Parameters

NameTypeDescription
optionsClientMethodHandler | IClientOptionsclient options or a client method handler.

Properties

methodHandler

methodHandler: ClientMethodHandler

Methods

destroy

destroy(): Promise<any>

Returns

Promise<any>


callMethod

callMethod(method): Promise<string>

Call a client method.

Parameters

NameTypeDescription
method__ClientMethods__The client method.

Returns

Promise<string>

A promise that resolves to a JSON string response holding the result of the client method.


listen

listen(topics, callback): Promise<void>

Listen to MQTT events.

Parameters

NameTypeDescription
topicsstring[]The topics to listen to.
callback(error: Error, result: string) => voidThe callback to be called when an MQTT event is received.

Returns

Promise<void>