Publishing and subscribing

Publishing to a topic

Calling Parameters

ParameterDescription
TopicName of the Xively channel you want to publish your message on. Xively topics are formatted in the following way: xi/blue/v1/<accountId>/d/<deviceId>/<channel name>
MessageThe message you want to send of any data type.
Encoding: UTF-8
Maximum length: 128 Kb
QoSDefault level: 0
RetainShould the message be retained on the server?

Response Parameters

ParameterDescription
ACK (Acknowledgement)Message successfully published

If an error is encountered, an error message is returned.

📘

Maximum message size

128kb is the maximum limit per message.

Subscribing to a topic

Subscribing sets up your device to receive messages on a topic. It can only be called once a client has been connected to the server.

ParameterDescription
TopicName of the Xively channel you want to subscribe to. Xively topics are formatted in the following way: xi/blue/v1/<accountId>/d/<deviceId>/<channel name>
QoSDefault level: 0

Callbacks
Most libraries and clients have a specific way of implementing the message callback functions, which will be executed when a message is received.

Response Parameters
Each subscription will return an acknowledgment that is set up on the server or the failure code if the subscription is not successful.

Updated 3 years ago


What's Next

That's all there is to MQTT. For detailed descriptions, check out the glossary.

MQTT Glossary

Publishing and subscribing


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.