SseConnection constructor

SseConnection(
  1. Sink _sink, {
  2. Duration? keepAlive,
})

Creates an SseConnection for the supplied _sink.

If keepAlive is supplied, the connection will remain active for this period after a disconnect and can be reconnected transparently. If there is no reconnect within that period, the connection will be closed normally.

If keepAlive is not supplied, the connection will be closed immediately after a disconnect.

Implementation

SseConnection(this._sink, {Duration? keepAlive}) : _keepAlive = keepAlive {
  _outgoingStreamQueue = StreamQueue(_outgoingController.stream);
  unawaited(_setUpListener());
  _outgoingController.onCancel = _close;
  _incomingController.onCancel = _close;
}