The MQTT Broker
service enables you to connect clients that support the MQTT protocol and easily encode the data and send to other services.
If you are interested in a feature not supported, please open a support ticket with your request.
Endpoint Key
in IoT Bridge.Endpoints
can be defined with a username and password to authorize the connection. The same username/password can be assigned to multiple endpoints.Service
can be configured to enable automatic endpoint creation by specifying a shared username/password that multiple devices can use. If a device authenticates using the auto-onboarding credentials, an endpoint will be automatically created for it.Topic scopes allow you to have multiple MQTT Broker services that have topics that are isolated from each-other. This enables use cases where multiple different types of devices may be communicating and you may wish to limit how messages get broadcast down to devices.
If a service is account scoped, then any publishes from devices, or publishes from a trigger invoking mqtt.publish()
will be sent to all endpoints or triggers in the account that are associated with the service. This is the default behavior and maintains the same topic space across your entire account.
If a service is service scoped, then any publishes to the service from devices or from a trigger invoking mqtt.publish()
will only be broadcast to devices and triggers referncing that service. This allows a high degree of isolation between different device types.
A related setting in the service can allow or block device to device communication. When enabled, any publishes will be sent to MQTT clients subscribed on the relevant topics. When set to false (default) then any publishes from devices will only cause MQTT Publish
trigger events to be generated, and will not send data to devices.
The MQTT Broker service allows configuration of the topic subscriptions, and the automatic onboarding features.
Account
scoped means that all messages published to this service will be broadcast to all other services in the account that are Account
scoped. Service
scoped means that messages published to this service will only be distributed to endpoints associated with this service.mqtt-publish
event will be generated.true
topic publishes sent from devices will be sent to all devices with matching subscriptions, when false
, publishes from devices will not be re-published to other devices, regardless of their active subscriptions.This event fires when a client connects to the MQTT broker.
{
"remoteAddr": "1.2.3.4:5293"
}
This event fires when a client disconnects from the MQTT broker.
## no event data
This event fires when a topic is published to the MQTT broker from either a trigger or a device.
{
"topic": "device/asdf91321/telemetry",
"payload": {
"location": {
"lat": 43.123123,
"lng": -80.12314
},
"temp": 23.3
}
}
object
, string
, or byte[]
depending on the source data.This event fires when a client subscribes to topics in the MQTT broker.
{
"topics": ["a/b/c","d/e/#"],
"qoss": [0,1]
}
This event fires when a client unsubscribes from topics in the MQTT broker.
{
"topics": ["a/b/c","d/e/#"]
}
var options = {
headers: { Authorization: 'BEARER <mytoken>' }
}
Publish a message on an MQTT topic.
// Publish an object to a topic as JSON.
mqtt.publish('mybroker','device/config', { pollInterval: 30 })
// Publish a string to a topic.
mqtt.publish('mybroker','device/config', 'poll,30')
The following events are considered billable:
Broker functionality is improving constantly, if there is an MQTT feature you would like to see, please open a support ticket.