node-red-contrib-mhub 1.2.1

MHub publish/subscribe nodes for Node-RED

npm install node-red-contrib-mhub

This package provides "MHub in" (i.e. subscribe) and "MHub out" (i.e. publish) nodes for Node-RED.

MHub is a simple, flexible message bus using a JSON-based protocol. It natively supports websockets, but also 'plain' TCP ports.

Because both the protocol and the messages are transmitted using JSON, this makes it very powerful, yet still simple enough to be directly implemented in e.g. a microcontroller.


In Node-RED:

  • click the top-right 'hamburger' menu
  • click "Manage palette"
  • click the "Install" tab
  • search "mhub" (or "node-red-contrib-mhub")
  • click its "Install" button

At a command prompt:

cd ~/.node-red/
npm install node-red-contrib-mhub

Upgrading can currently only be done at the command prompt:

cd ~/.node-red/
npm update node-red-contrib-mhub


Usage is very simple and basically the same as using e.g. the builtin MQTT nodes:

  • Drag an MHub in or out node onto the canvas
  • Double-click to edit properties
  • Click the pencil icon to add/edit server settings
  • Fill in the other details
    • For an In node, leave the "Pattern" empty to receive all messages
    • For an Out node, use any "Topic" you like.


  • MHub messages are sent as an object containing topic, data and headers properties. Node-RED by convention calls the .data property .payload, so the MHub in/out nodes emit/accept that name instead.
  • Messages in MHub are JSON objects, but many Node-RED nodes default to set the .payload property to a string. It's an easy mistake to enter JSON in that box, which will cause the other side to receive a string instead of an object.


Notable changes listed below, for details see the version tags in Git.

1.2.1 (2017-02-26):

  • Fix node stop/restart when DNS lookup takes long (MHub 0.8.0)
  • Fix hang during stop when server node configured without publish/subscribe nodes

1.2.0 (2016-11-12):

  • Implement keepalive (MHub 0.7.0)
  • Make TLS actually work

1.1.0 (2016-11-03):

  • Allow leaving 'node' field empty to use "default"
  • Show hostname as connected status

1.0.0 (2016-10-31):

  • Initial version


The MIT license.

Copyright (C) 2016 Martin Poelstra

Node Info

Version: 1.2.1
Updated 6 months, 1 week ago
License: MIT


1 in the last day
13 in the last week
44 in the last month


  • mhub in
  • mhub out
  • mhub-server


  • node-red
  • mhub


  • poelstra