subscribe method
Request a ClientSubscription to the desired eventName
from the server.
Implementation
@override
Future<ClientSubscription> subscribe(String eventName) {
var c = Completer<Map>();
var requestId = _uuid.v4();
_requests[requestId] = c;
_peer!.sendNotification('subscribe', {
'request_id': requestId,
'client_id': clientId,
'event_name': eventName
});
return c.future.then<ClientSubscription>((result) {
_clientId = result['client_id'] as String?;
var s = _JsonRpc2ClientSubscription(
eventName, result['subscription_id'] as String?, this);
_subscriptions.add(s);
return s;
});
}