@iota/mqtt.js
TypeScript icon, indicating that this package has built-in type declarations

1.8.6 • Public • Published

MQTT

This package provides mqtt support.

Install

npm install @iota/mqtt.js

MQTT Operations

You can create a MQTT client which once connected can stream the following feeds.

  • milestonesLatest
  • milestonesConfirmed
  • messageMetadata - Metadata updates for a specified messageId
  • output - Output updates for a specified outputId
  • addressOutputs - Address output updates for a specified address
  • address25519Outputs - Address output updates for a specified ed25519 address
  • messagesRaw - All messages in binary form
  • messages - All messaged decoded to objects
  • indexRaw - All messages for a specified indexation key in binary form
  • index - All messages for a specified indexation key in object form
  • messagesMetadata - All metadata updates

Usage

import { MqttClient } from "@iota/mqtt.js";

const mqttClient = new MqttClient(MQTT_ENDPOINT);

mqttClient.messages((topic, data, raw) => console.log(topic, data))

Additional Examples

Please find other examples in the ./examples folder.

  • Mqtt - Using mqtt to read streaming messages.
  • Browser Mqtt - Using mqtt to read streaming messages in the browser.

/@iota/mqtt.js/

    Package Sidebar

    Install

    npm i @iota/mqtt.js

    Weekly Downloads

    53

    Version

    1.8.6

    License

    Apache-2.0

    Unpacked Size

    170 kB

    Total Files

    35

    Last publish

    Collaborators

    • domschiener
    • iota_ci