MQTT Front Connector

Content Type: Service
Categories: Communication

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.3.0)

User and password not tested  (v1.3.0)

Dependencies

  • mqtt (bundled using webpack)
    https://github.com/mqttjs 

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.4.1
Framework Version: 9.24.12
Release Notes: change comment for Host parameter to remind that only websocket is supported in frontend
Version: 1.4.0
Framework Version: 9.24.12
Release Notes: Mx10 ready by updating at 9.24.12 + fix the update datamodel error
Version: 1.3.0
Framework Version: 9.12.2
Release Notes: Direct use of MQTT.js (remove of the async-mqtt) Fix a bug by ensuring New MqttClientId at reconnection while keeping context object (the bug was causing overload of broker and performance decrease) Fix a bug to apply QoS
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