MQTT Broker
MQTT is a popular publish/subscribe protocol often used in IoT contexts.
If you’re using Meraki cameras, you can connect to our MQTT broker to receive live occupancy updates.
The broker is available over plain TCP sockets (a good fit for backend services) and WebSockets (a good fit for web browsers).
URLs
The broker is accessible:
- Over
TCP
atmqtt.analytiks.ai
on port1884
- Over secured WebSockets at
streams.analytiks.ai
on port443
(the default port)
Connection and authorization
In order to subscribe to MQTT topics, you’ll need your brand UUID, and possibly a location UUID. Both can be retrieved via GraphQL using the following query:
{
locationList {
name
uuid
brand {
name
uuid
}
}
}
When connecting, make sure to use the brand UUID as the username and password in your MQTT client. Using mqtt.js over websockets as an example:
mqtt.connect("wss://streams.analytiks.ai", {username: "__BRAND_UUID__", password: "__BRAND_UUID__"})
Topics
The main subscription pattern is /brand/__BRAND_UUID__/location/__LOCATION_UUID__/liveCameras
.
The usual MQTT subscription patterns may be used, the only exception being #
, the root topic, which will be rejected.
To subscribe to all locations your brand has access to, you can use /brand/__BRAND_UUID__/location/+/liveCameras
.
Otherwise, you can send multiple subscription requests for each location you are interested in.
Messages
Messages will be published in the following format:
{
locationId: string; // ID of the location
occupancy: number; // Current Occupancy measured in the location
visits: number; // Number of entrances from the opening
}