Erweiterungen

This commit is contained in:
Sven committed 2024-03-20 11:09:34 +01:00
1 parent 23693f47a4
commit f764503d7e
1 file changed
+9 -3
+9 -3
View File
@@ -1,5 +1,6 @@
import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'dart:math';
import 'package:isar/isar.dart';
@@ -130,12 +131,17 @@ class MqttCore {
publishText(String subtopic, String text) {
try {
var buffer = Uint8Buffer();
buffer.addAll(text.codeUnits);
var textBuffer = Uint8Buffer();
textBuffer.addAll(text.codeUnits);
var compressedText = GZipCodec().encode(text.codeUnits);
var mqttBuffer = Uint8Buffer();
mqttBuffer.addAll(compressedText);
var topic = "$_toServerTopic$subtopic/$_clientId";
_mqttClient.publishMessage( topic, MqttQos.exactlyOnce, buffer);
_mqttClient.publishMessage( topic, MqttQos.exactlyOnce, mqttBuffer);
Util.logInfo("send message $text to $topic");
} catch (e) {