UbSub supports MQTT by proxying through a Eclipse Mosquitto.


Connecting to MQTT Server


You can connect to the MQTT server with many popular clients. The server is set up to use TLS, and you can authenticate with your username/secret OR any token/secret pairs.

Eg. mqtts://

Upon connecting, you can publish/subscribe to anything in your base path which is UBSUB/${userId}/#

You can read more about mosquitto/mqtt pathing here.

Publishing a message

To publish to a UbSub topic, simply emit an event to UBSUB/<username>/TOPIC/<nameOrId>. This will either emit to an existing topic that matches by name or id, or it will create a new topic with the last field as a given Id.


Once you have created the initial ubsub-to-mqtt link by subscribing to a specific topic, you can subscribe to it again or you can listen to wildcards.

To subscribe to a topic, simply subscribe to UBSUB/<username>/SUB/<nameOrId>

Once you have subscribed to a topic, you will also be able to pick up messages via a wildcard, eg UBSUB/<username>/SUB/#.


You can also listen and publish to nested sub-topics, but they will be converted with how they are represented in ubsub to replace / with ..

For example:

If you publish to the topic UBSUB/<username>/TOPIC/a/b/c it will publish to the UbSub topic a.b.c


Like the rest of UbSub, all events are assumed to be JSON. If they can't be parsed as JSON, it will be encapsulated like so: { "payload": "raw string data" }


Another powerful feature of MQTT is the ability to create local to remote bridges. This allows you to run your own broker, and only connect certain topics to UbSub's broker.

Example configuration:

connection mybridge


bridge_capath /etc/ssl/certs
remote_clientid mybridge
remote_username <username>
remote_password <password>

bridge_insecure false
log_type all
cleansession true

try_private true
notifications_local_only true

topic UBSUB/<username>/# both 0

start_type automatic