Go
Quick guide for Go library.
Getting Started
Visit the MQTT overview page for conventions, authentication, and more information.
This documentation uses the Paho MQTT
library. This library is open-source, so you can check it on GitHub.
Installing the packages
Import libraries
Then import it and initialize it with the required packages. Of course, youβll want to replace DEVICE_ID
and DEVICE_TOKEN
with your actual device credentials which you can find under your device settings on Qubitro Portal.
Add the following code to the top of your page
Define Variables
Setup MQTT Client
Define Callbacks
Define callbacks depending on your scenario.
See the examples below or visit the package documentation.
Prepare Data
Examples
We strongly recommend using the 8883 port for MQTT over TLS connectivity.
Publish
Subscribe
Message
Disconnect
Last updated
Was this helpful?