publish method

  1. @override
Future publish(
  1. String eventName,
  2. dynamic value
)
override

Publishes an event to the server.

Implementation

@override
Future publish(String eventName, value) {
  return _whenConnected(() {
    var c = Completer<Map>();
    var requestId = _uuid.v4();
    _requests[requestId] = c;
    serverSendPort.send({
      'id': _id,
      'request_id': requestId,
      'method': 'publish',
      'params': {
        'client_id': clientId,
        'event_name': eventName,
        'value': value
      }
    });
    return c.future.then((result) {
      _clientId = result['client_id'] as String?;
    });
  });
}