ObbyAsyncClient.withClient constructor
Drive an ObbyClient a host already built, over an already-open transport.
Implementation
ObbyAsyncClient.withClient(this.client, Stream<List<int>> incoming, this._send) {
_stopwatch.start();
client.handleConnected();
_flush();
_scheduleTick();
_sub = incoming.listen(
(chunk) {
// an errored stream keeps delivering unless it is told not to, and the engine is gone by
// then
if (_closed) return;
client.handleBytes(Uint8List.fromList(chunk));
_tickNow();
_flush();
_drain();
_scheduleTick();
},
onDone: _onTransportClosed,
onError: (Object _) => _onTransportClosed(),
cancelOnError: true,
);
}