1.0.5 • Published 3 years ago

@htblaleonie/leonie-mqtt v1.0.5

Weekly downloads
2
License
MIT
Repository
github
Last release
3 years ago

leonie-mqtt

The Leonie MQTT-Client. It has a type safe API for sending and receiving MQTT messages easier.

Usage

Install

npm i @htblaleonie/leonie-mqtt

Create instance

import MqttClient from '@htblaleonie/leonie-mqtt';

const client = new MqttClient(config.mqttUrl);

Publish

client.publish(token, topic, payload, err => {
    if (err) {
        console.error(err);
    }
});

Params:

  • token
  • topic
  • payload
  • callback(err)

Subscribe

client.subscribe(token, topic, (topic, message, err) => {
    if (err) {
        console.error(err);
    } else {
        console.log(message.toString());
    }
});

Params:

  • token
  • topic
  • callback(topic, message, err)

Building and publishing

To easily make this code available to other teams, it's being published on npm. Effectively, this means that everything in this folder is public!

To publish a new version on npm

  1. Increment the version in the package.json (we are using semantic versioning)
  2. Run npm publish

Copyright © 2020 - 2021, Jonas Dorfinger. This package is MIT licensed

1.0.5

3 years ago

1.0.4

3 years ago

1.0.2

3 years ago

1.0.3

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago