publishText method

Future<OnMessage> publishText(
  1. String topic,
  2. String data, {
  3. int maxHoldingSeconds = 8640000,
  4. bool txPool = false,
  5. int offset = 0,
  6. int limit = 1000,
})

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;
  }
}