iota-client 1.4.0

The official, general-purpose IOTA client library in Rust for interaction with the IOTA network (Tangle)
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import CodeBlock from "@theme/CodeBlock";
import mqtt from "!!raw-loader!../../../../../bindings/nodejs/examples/10_mqtt.js";

You can reach the listener using an instance of a
[`Client.TopicSubscriber`](./../libraries/nodejs/api_reference#topicsubscriber) object that is returned from the
[`Client.subscriber()`](./../libraries/nodejs/api_reference#subscriber-topicsubscriber) function. It offers several
chaining calls:

- [`.topic(str)`](./../libraries/nodejs/api_reference#topictopic-topicsubscriber) /
  [`.topics(str[])`](./../libraries/nodejs/api_reference#topicstopic-topicsubscriber): A topic or list of topics that
  should trigger a provided callback.
- [`.subscribe(cb)`](./../libraries/nodejs/api_reference#subscribecb-topicsubscriber): Subscribes the listener to a callback function that is being triggered every time the given topic(s)
  is noticed.
- [`.unsubscribe(cb)`](./../libraries/nodejs/api_reference#unsubscribecb-callback-topicsubscriber): Unsubscribes the listener from the given topics. Once unsubscribed, the given callback function is
  executed in the form `(err, message) => {}`.

<CodeBlock className="language-javascript">{mqtt}</CodeBlock>