publishText method
publishText sends bytes or string data to all subscribers of a topic with an optional config.
Implementation
Future<OnMessage> publishText(String topic, String data, {int maxHoldingSeconds = 8640000, bool txPool = false, int offset = 0, int limit = 1000}) async {
try {
final Map resp = await _methodChannel.invokeMethod('publishText', {
'_id': this.address,
'topic': topic,
'data': data,
'maxHoldingSeconds': maxHoldingSeconds,
'txPool': txPool,
'offset': offset,
'limit': limit,
});
OnMessage message = OnMessage(
messageId: resp['messageId'],
data: resp['data'],
type: resp['type'],
encrypted: resp['encrypted'],
src: resp['src'],
noReply: resp['noReply'],
);
return message;
} catch (e) {
rethrow;
}
}