
MQTT.DART - MQTT Client Library Encyclopedia

Written by Jean-Noel Guillerme
Category: MQTT MQTT Client MQTT Client Library
Published: October 5, 2015
Short info
MQTT.DART | |
---|---|
Language | Dart |
Website | github.com/jnguillerme/mqtt.dart |
Description
I developed the MQTT Dart library as I was working on the backend of a mobile app in 2013. The backend was developed in Dart but I could not find any MQTT library.
I’ve not been too active on the library recently due to lack of time. But I have plan to review the library with the latest Dart features and include the missing MQTT features before the end of the year.
Features
Feature | |
---|---|
MQTT 3.1 | ![]() |
MQTT 3.1.1 | ![]() |
LWT | ![]() |
SSL/TLS | ![]() |
Automatic Reconnect | ![]() |
Feature | |
---|---|
QoS 0 | ![]() |
QoS 1 | ![]() |
QoS 2 | ![]() |
Authentication | ![]() |
Throttling | ![]() |
Usage
Installation
Add this to your package’s pubspec.yaml file:
|
|
You can install packages from the command line:
|
|
In your dart code add:
|
|
Connect
1.Define a connection Before connecting to the broker you must define a connection. Web socket and socket connections are supported:
websocket:
|
|
socket:
|
|
2.Create a client
|
|
3.Connect
|
|
Connect with LWT
1. Define a connection Before connecting to the broker you must define a connection. Web socket and socket connections are supported:
websocket:
|
|
socket:
|
|
2. Create a client
|
|
3. Define the will
|
|
4. Connect
|
|
Connect with Username / Password
Create the client as :
|
|
Publish
|
|
Publish a retained message
|
|
Subscribe
|
|
Unsubscribe
|
|
Disconnect
|
|

About Jean-Noel Guillerme
Thanks for this guest blog postJean-Noel works as an independent software developer in London. He has been working on projects around messaging for more than 10 years. Jean-Noel started working with MQTT a couple of years ago, when he was involved in mobile app projects.
Follow Jean-Noel on Github
How to Use the Paho MQTT Client in Python - MQTT Client Library Encyclopedia