send method

Future<void> send(
  1. String request,
  2. String receiverPublicKey,
  3. String topic, {
  4. int? ttl,
})

Implementation

Future<void> send(String request, String receiverPublicKey, String topic,
    {int? ttl}) async {
  final bridgeBase = _bridgeUrl;

  var bridgeUrl = '$bridgeBase/$postPath?client_id=$_sessionId';
  final ttlValue = ttl ?? defaultTtl;
  bridgeUrl += '&to=$receiverPublicKey&ttl=$ttlValue&topic=$topic';

  final xhr = HttpRequest();
  xhr.open('POST', bridgeUrl);
  xhr.setRequestHeader('Content-Type', 'application/json; charset=utf-8');
  xhr.send(request);
}