Last active
May 15, 2021 07:55
-
-
Save ova2/bcedd7ef98386f99442147655bbc2f53 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:mqtt_client/mqtt_client.dart'; | |
import 'package:rxdart/rxdart.dart'; | |
class MessagingService { | |
/// Subscribes to the given topic and produces a stream of received updates from the message | |
/// broker matching this topic. You can also pass [MqttQos] which defaults to atLeastOnce. | |
/// | |
/// This method returns a stream of [MqttMessage] instances. | |
Stream<MqttMessage> updatesFor(String topic, [MqttQos qos = MqttQos.atLeastOnce]) { | |
... | |
} | |
/// Publishes a message to the message broker. You should pass a topic and serialized | |
/// message data in JSON format. You can also pass [MqttQos] which defaults to atLeastOnce. | |
/// | |
/// This method returns a [Future] of message identifer [int] assigned to the message. | |
Future<int> request(String topic, String jsonData, [MqttQos qos = MqttQos.atLeastOnce]) { | |
... | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment