MQTT Front Connector

Category: Modules
Subcategory: Messaging

Overview

Allows the frontend client to publish and subscribe to a MQTT broker for a real-time user experience.

Can be combined with the official MQTT module which operates on the backend only (microflows).

Documentation

 

Description

Allows the frontend client to publish and subscribe to a MQTT broker for a real-time user experience.

Can be combined with the official MQTT module which operates on the backend only (microflows).

This module relies on “MQTT.js” bundled in javascript actions for nanoflows.

It requires a MQTT broker connection based on websocket  “ws://” or “wss://”

Typical usage scenario

  • real-time user experiences like dashboarding and warnings
  • Multi-Concurrent-Experience between the screen (desktop app), IoT device in the hand of the user, and Alexa for voice control
  • Cloud hosting of the backend and connection to local MQTT

Features and limitations

secured websocket not tested (v1.2.0)

User and password not tested  (v1.2.0)

Dependencies

  • async-mqtt (bundled using webpack)
    https://www.npmjs.com/package/async-mqtt 

Configuration 

Just consumes the publish and subscribe activities in nanoflows.

The subscribe activity refers to a “onMessage” nanoflow. Please use the provided nanoflow template since the input parameters names are hardcoded in the javascript action.

The subcription can work on native mobile, fully independant from backend. 

The challenge in implementation can be to maintain a unique subscription and avoid duplication, the options contextRegistered, subscriberContext and clientEnd allows you to alter the behaviors. See contextual comments for more guidance.

Watch the Studio Pro console “client”, eventually set the log level to trace.

Known bugs 

  • None

Releases

Version: 1.2.0
Framework Version: 9.12.1
Release Notes: Add options for subscription : QoS, user, password, Context Registration, ClientEnd Add Unsubscribe activities not tested : user, password,secured connection (wss://)
Version: 1.1.0
Framework Version: 9.10.1
Release Notes: Add an argument to keep a subscription client opened or not. Implement a keyword to end the client of a subscription.
Version: 1.0.0
Framework Version: 9.10.1
Release Notes: Initial release. Secured Websocket wss:// not tested