pip_services3_mqtt 1.0.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 50

Pip.Services Logo #

MQTT Messaging for Dart #

This framework is a part of Pip.Services project. It contains MQTT messaging components: MqttMessageQueue, MqttConnectionResolver

Quick Links:

Acknowledgements #

The Dart version of Pip.Services is created and maintained by:

  • Sergey Seroukhov
  • Levichev Dmitry

The documentation is written by:

  • Levichev Dmitry

MQTT Messaging for Pip.Services in Dart Changelog #

1.0.0 #

  • Initial version, created by Sergey Seroukhov and Dmitry Levichev

example/main.dart

import 'dart:async';
import 'dart:io';
import 'package:pip_services3_commons/pip_services3_commons.dart';
import 'package:pip_services3_messaging/pip_services3_messaging.dart';

import 'package:pip_services3_mqtt/pip_services3_mqtt.dart';

class TestMessageReciver implements IMessageReceiver {
  MessageEnvelope message;

  @override
  Future receiveMessage(MessageEnvelope envelope, IMessageQueue queue) {
    message = envelope;
    return null;
  }
}

void main() async {
  MqttMessageQueue queue;
  var brokerHost = Platform.environment['MOSQUITTO_HOST'] ?? 'localhost';
  var brokerPort = Platform.environment['MOSQUITTO_PORT'] ?? 1883;
  var brokerTopic = Platform.environment['MOSQUITTO_TOPIC'] ?? '/test';
  if (brokerHost == '' && brokerPort == '') {
    return;
  }

  var queueConfig = ConfigParams.fromTuples([
    'connection.protocol',
    'mqtt',
    'connection.host',
    brokerHost,
    'connection.port',
    brokerPort,
    'connection.topic',
    brokerTopic
  ]);
  queue = MqttMessageQueue();
  queue.configure(queueConfig);

  await queue.open(null);
  await queue.clear(null);
  // Synchronus communication
  var envelope1 = MessageEnvelope('123', brokerTopic, 'Test message');
  MessageEnvelope envelope2;

  await queue.send(null, envelope1);
  var count = await queue.readMessageCount(); // count = 1
  envelope2 =
      await queue.receive(null, 10000); // envelope2.message = envelope1.message

  //====================================================================
  // Asynchronus communicaton
  var reciver = TestMessageReciver();
  queue.beginListen(null, reciver);
  await Future.delayed(Duration(milliseconds: 1000), () {});
  await queue.send(null, envelope1);
  await Future.delayed(Duration(milliseconds: 1000), () {});
  // read recived message
  envelope2 = reciver.message; // envelope1.message = envelope2.message
  queue.endListen(null);

  await queue.close(null);
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  pip_services3_mqtt: ^1.0.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:pip_services3_mqtt/pip_services3_mqtt.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
50
Learn more about scoring.

We analyzed this package on Jul 10, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.14

Analysis suggestions

Package not compatible with SDK flutter

Because it is not compatible with any of the supported runtimes: flutter-native, flutter-web

Package not compatible with runtime flutter-native on android

Because:

  • package:pip_services3_mqtt/pip_services3_mqtt.dart that imports:
  • package:pip_services3_mqtt/src/queues/queues.dart that imports:
  • package:pip_services3_mqtt/src/queues/MqttMessageQueue.dart that imports:
  • package:pip_services3_mqtt/src/connect/MqttConnectionResolver.dart that imports:
  • package:pip_services3_components/pip_services3_components.dart that imports:
  • package:pip_services3_components/src/Component.dart that imports:
  • package:pip_services3_components/src/count/CompositeCounters.dart that imports:
  • package:pip_services3_commons/pip_services3_commons.dart that imports:
  • package:pip_services3_commons/src/validate/validate.dart that imports:
  • package:pip_services3_commons/src/validate/ProjectionParamsSchema.dart that imports:
  • package:pip_services3_commons/src/validate/ArraySchema.dart that imports:
  • package:pip_services3_commons/src/reflect/ObjectReader.dart that imports:
  • package:pip_services3_commons/src/reflect/PropertyReflector.dart that imports:
  • dart:mirrors

Package not compatible with runtime flutter-native on ios

Because:

  • package:pip_services3_mqtt/pip_services3_mqtt.dart that imports:
  • package:pip_services3_mqtt/src/queues/queues.dart that imports:
  • package:pip_services3_mqtt/src/queues/MqttMessageQueue.dart that imports:
  • package:pip_services3_mqtt/src/connect/MqttConnectionResolver.dart that imports:
  • package:pip_services3_components/pip_services3_components.dart that imports:
  • package:pip_services3_components/src/Component.dart that imports:
  • package:pip_services3_components/src/count/CompositeCounters.dart that imports:
  • package:pip_services3_commons/pip_services3_commons.dart that imports:
  • package:pip_services3_commons/src/validate/validate.dart that imports:
  • package:pip_services3_commons/src/validate/ProjectionParamsSchema.dart that imports:
  • package:pip_services3_commons/src/validate/ArraySchema.dart that imports:
  • package:pip_services3_commons/src/reflect/ObjectReader.dart that imports:
  • package:pip_services3_commons/src/reflect/PropertyReflector.dart that imports:
  • dart:mirrors

Package not compatible with runtime flutter-native on linux

Because:

  • package:pip_services3_mqtt/pip_services3_mqtt.dart that imports:
  • package:pip_services3_mqtt/src/queues/queues.dart that imports:
  • package:pip_services3_mqtt/src/queues/MqttMessageQueue.dart that imports:
  • package:pip_services3_mqtt/src/connect/MqttConnectionResolver.dart that imports:
  • package:pip_services3_components/pip_services3_components.dart that imports:
  • package:pip_services3_components/src/Component.dart that imports:
  • package:pip_services3_components/src/count/CompositeCounters.dart that imports:
  • package:pip_services3_commons/pip_services3_commons.dart that imports:
  • package:pip_services3_commons/src/validate/validate.dart that imports:
  • package:pip_services3_commons/src/validate/ProjectionParamsSchema.dart that imports:
  • package:pip_services3_commons/src/validate/ArraySchema.dart that imports:
  • package:pip_services3_commons/src/reflect/ObjectReader.dart that imports:
  • package:pip_services3_commons/src/reflect/PropertyReflector.dart that imports:
  • dart:mirrors

Package not compatible with runtime flutter-native on macos

Because:

  • package:pip_services3_mqtt/pip_services3_mqtt.dart that imports:
  • package:pip_services3_mqtt/src/queues/queues.dart that imports:
  • package:pip_services3_mqtt/src/queues/MqttMessageQueue.dart that imports:
  • package:pip_services3_mqtt/src/connect/MqttConnectionResolver.dart that imports:
  • package:pip_services3_components/pip_services3_components.dart that imports:
  • package:pip_services3_components/src/Component.dart that imports:
  • package:pip_services3_components/src/count/CompositeCounters.dart that imports:
  • package:pip_services3_commons/pip_services3_commons.dart that imports:
  • package:pip_services3_commons/src/validate/validate.dart that imports:
  • package:pip_services3_commons/src/validate/ProjectionParamsSchema.dart that imports:
  • package:pip_services3_commons/src/validate/ArraySchema.dart that imports:
  • package:pip_services3_commons/src/reflect/ObjectReader.dart that imports:
  • package:pip_services3_commons/src/reflect/PropertyReflector.dart that imports:
  • dart:mirrors

Package not compatible with runtime flutter-native on windows

Because:

  • package:pip_services3_mqtt/pip_services3_mqtt.dart that imports:
  • package:pip_services3_mqtt/src/queues/queues.dart that imports:
  • package:pip_services3_mqtt/src/queues/MqttMessageQueue.dart that imports:
  • package:pip_services3_mqtt/src/connect/MqttConnectionResolver.dart that imports:
  • package:pip_services3_components/pip_services3_components.dart that imports:
  • package:pip_services3_components/src/Component.dart that imports:
  • package:pip_services3_components/src/count/CompositeCounters.dart that imports:
  • package:pip_services3_commons/pip_services3_commons.dart that imports:
  • package:pip_services3_commons/src/validate/validate.dart that imports:
  • package:pip_services3_commons/src/validate/ProjectionParamsSchema.dart that imports:
  • package:pip_services3_commons/src/validate/ArraySchema.dart that imports:
  • package:pip_services3_commons/src/reflect/ObjectReader.dart that imports:
  • package:pip_services3_commons/src/reflect/PropertyReflector.dart that imports:
  • dart:mirrors

Package not compatible with runtime flutter-web on web

Because:

  • package:pip_services3_mqtt/pip_services3_mqtt.dart that imports:
  • package:pip_services3_mqtt/src/queues/queues.dart that imports:
  • package:pip_services3_mqtt/src/queues/MqttMessageQueue.dart that imports:
  • package:pip_services3_mqtt/src/connect/MqttConnectionResolver.dart that imports:
  • package:pip_services3_components/pip_services3_components.dart that imports:
  • package:pip_services3_components/src/Component.dart that imports:
  • package:pip_services3_components/src/count/CompositeCounters.dart that imports:
  • package:pip_services3_commons/pip_services3_commons.dart that imports:
  • package:pip_services3_commons/src/validate/validate.dart that imports:
  • package:pip_services3_commons/src/validate/ProjectionParamsSchema.dart that imports:
  • package:pip_services3_commons/src/validate/ArraySchema.dart that imports:
  • package:pip_services3_commons/src/reflect/ObjectReader.dart that imports:
  • package:pip_services3_commons/src/reflect/PropertyReflector.dart that imports:
  • dart:mirrors

Package not compatible with runtime js

Because:

  • package:pip_services3_mqtt/pip_services3_mqtt.dart that imports:
  • package:pip_services3_mqtt/src/queues/queues.dart that imports:
  • package:pip_services3_mqtt/src/queues/MqttMessageQueue.dart that imports:
  • package:pip_services3_mqtt/src/connect/MqttConnectionResolver.dart that imports:
  • package:pip_services3_components/pip_services3_components.dart that imports:
  • package:pip_services3_components/src/Component.dart that imports:
  • package:pip_services3_components/src/count/CompositeCounters.dart that imports:
  • package:pip_services3_commons/pip_services3_commons.dart that imports:
  • package:pip_services3_commons/src/validate/validate.dart that imports:
  • package:pip_services3_commons/src/validate/ProjectionParamsSchema.dart that imports:
  • package:pip_services3_commons/src/validate/ArraySchema.dart that imports:
  • package:pip_services3_commons/src/reflect/ObjectReader.dart that imports:
  • package:pip_services3_commons/src/reflect/PropertyReflector.dart that imports:
  • dart:mirrors

Package not compatible with runtime native-aot

Because:

  • package:pip_services3_mqtt/pip_services3_mqtt.dart that imports:
  • package:pip_services3_mqtt/src/queues/queues.dart that imports:
  • package:pip_services3_mqtt/src/queues/MqttMessageQueue.dart that imports:
  • package:pip_services3_mqtt/src/connect/MqttConnectionResolver.dart that imports:
  • package:pip_services3_components/pip_services3_components.dart that imports:
  • package:pip_services3_components/src/Component.dart that imports:
  • package:pip_services3_components/src/count/CompositeCounters.dart that imports:
  • package:pip_services3_commons/pip_services3_commons.dart that imports:
  • package:pip_services3_commons/src/validate/validate.dart that imports:
  • package:pip_services3_commons/src/validate/ProjectionParamsSchema.dart that imports:
  • package:pip_services3_commons/src/validate/ArraySchema.dart that imports:
  • package:pip_services3_commons/src/reflect/ObjectReader.dart that imports:
  • package:pip_services3_commons/src/reflect/PropertyReflector.dart that imports:
  • dart:mirrors

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
mqtt_client ^7.1.0 7.2.1
pip_services3_commons >=1.0.4 <2.0.0 1.0.11
pip_services3_components >=1.0.2 <2.0.0 1.0.6
pip_services3_messaging >=1.0.0 <2.0.0 1.0.1
Transitive dependencies
charcode 1.1.3
collection 1.14.13 1.15.0-nullsafety
convert 2.1.1
crypto 2.1.5
event_bus 1.1.1
meta 1.2.2 1.3.0-nullsafety
mustache4dart2 0.1.0
path 1.7.0
source_span 1.7.0
sprintf 4.0.2
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.2.0 1.3.0-nullsafety
uuid 2.2.0
yaml 2.2.1
Dev dependencies
test >=1.14.2 <2.0.0