SseConnection constructor
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.
ignoreDisconnect is the duration to ignore a disconnect after a
reconnection. This is useful as the SSE disconnection event may arrive
after the new connection is established.
Implementation
SseConnection(this._sink, {Duration? keepAlive, Duration? ignoreDisconnect})
: _keepAlive = keepAlive,
_ignoreDisconnect = ignoreDisconnect {
_outgoingStreamQueue = StreamQueue(_outgoingController.stream);
unawaited(_setUpListener());
_outgoingController.onCancel = _close;
_incomingController.onCancel = _close;
}