PubSubSynchronizationChannel constructor
PubSubSynchronizationChannel(- Client client
)
Implementation
PubSubSynchronizationChannel(this.client) {
_ctrl.local.stream.listen((e) {
return client
.publish(eventName, e.toJson())
.catchError(_ctrl.local.sink.addError);
});
client.subscribe(eventName).then((sub) {
_subscription = sub
..listen((data) {
// Incoming is a Map
if (data is Map) {
var e = new WebSocketEvent.fromJson(data);
_ctrl.local.sink.add(e);
}
}, onError: _ctrl.local.sink.addError);
}).catchError(_ctrl.local.sink.addError);
}