A server side MQTT client for Dart.
The client is an MQTT v3(3.1 and 3.1.1) implementation supporting subscription/publishing at all QOS levels, keep alive and synchronous connection. The client is designed to take as much MQTT protocol work off the user as possible, connection protocol is handled automatically as are the message exchanges needed to support the different QOS levels and the keep alive mechanism. This allows the user to concentrate on publishing/subscribing and not the details of MQTT itself.
Examples of usage can be found in the examples directory. An example is also provided showing how to use the client to connect to the mqtt-bridge of Google's IoT-Core suite. This demonstrates how to use secure connections and switch MQTT protocols. The test directory also contains standalone runnable scripts demonstrating subscription, publishing and topic filtering.
The client supports both normal and secure TCP connections and server side secure(wss) and non-secure(ws) websocket connections.
The client has been used successfully with the MQTT brokers from several of the major cloud providers IOT/MQTT platforms, including :-
It has also been used with a range of both publicly available brokers such as Mosquitto and proprietary ones. An example using the adafruit MQTT broker for flutter can be found here.
The code is a port from the C# nMQTT client library to Dart.
#5.5.3 Issues 85 and 87
#5.5.2 Fix for dart 2.2 usage
#5.5.1 Issue 81
Issues 69, 74 and 79
Issues 67 and 68
Issues 61, 62 and 63
Issues 59 + 60
Issues 54, 55 and 56
Roll up release for issues 48, 49, 50, 52 and 53, warning - breaking API change for connection state and security context in secure mode hence the major version bump.
Issue 45, better connection fail reporting, update linter, note breaking API change for turning logging on/off
Issue 40, disconnected clients
Issue 26, example code for flutter
Issue 38 QOS1 + 2 protocol handling bugs, Issue 34 Flutter buffers
Issue 38 QOS1 + 2 protocol handling bugs
Issue 37 onSubscribed and OnUnsubscribed callbacks
Issues 32 bug fix
Issues 32 and 35
Issues 27 and 29, pull request 30
Update to Dart 2, major version bump only to create a clean break from Dart 1
Issue 23, all subscriptions are now on one client level observable, not on seperate ones per subscription, this change is NOT backwards compatible
Issue 22, don't disconnect if we have no connection established
Issue 19, multitopic subscriptions + other more minor updates, API changed on this version.
Pull request 14, Making library more compliant to work with VerneMQ - explicit setting of will qos.
Issue 10, add library prefix for observable
Issue 10, update Observable version to 'any'
Add the payload builder utility.
Update Observable version
Remove eventable and its dependency on mirrors, replace with event_bus, issue 10
Fixes for issue 8, pub suggestions fixed.
Fixes for issues 5 and 6
Fixes for issues 3 and 4
Add secure sockets, server side only Add ability to select the MQTT protocol between 3.1 and 3.1.1 A few code and test tidy ups Tested to work with iot-core MQTT bridge
Add websockets as an alternative network connection server side only
Fix unit tests on Travis
Add this to your package's pubspec.yaml file:
dependencies: mqtt_client: ^5.5.3
You can install packages from the command line:
$ pub get
$ flutter pub get
Alternatively, your editor might support
pub get or
flutter pub get.
Check the docs for your editor to learn more.
Now in your Dart code, you can use:
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
We analyzed this package on Aug 22, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:
Detected platforms: Flutter, other
Maintain an example. (-10 points)
Create a short demo in the
example/ directory to show how to use this package.
Common filename patterns include
mqtt_client.dart. Packages with multiple examples should provide
For more information see the pub package layout conventions.
|Dart SDK||>=2.0.0-dev <3.0.0|