<topic ID>/out and the platform delivers the topic’s messages to your client as they arrive.
The topic ID is on the topic card, for example
u0123456789abcdef-orders, so the read channel is u0123456789abcdef-orders/out.
HTTP and HTTPS connections only publish: send a
POST to the connection URL. Reading always goes
through MQTT.Connect
Use the MQTT or MQTTS broker URL from the topic card and a client ID that is unique for every session. Then authenticate in one of two ways.- Access token
- SCRAM credential
Works with an account token or a consumer subaccount token.The token is checked when the client connects. Get a fresh token for every new connection.
Example with MQTT.js
read.mjs
How delivery works
- Delivery to
/outruns while at least one client is subscribed. The first subscription can take a little while to start it. - When nobody is subscribed, the topic keeps the messages. Delivery resumes from where it stopped when a client subscribes again, as long as the topic still keeps those messages (seven days by default, see Plans and limits).
- Messages are delivered to the clients subscribed at that moment.
Read more than one topic
Consumers can also read the topics you allowed in Read access:- SCRAM consumer credential: one connection can subscribe to
<topic ID>/outof every allowed topic. - Access token: the username names one topic, so open one connection per topic, each with that topic’s ID as the username. A consumer subaccount reaches the topics you ticked under Also read from.