Repository navigation
Patch Changes
-
#244
cc6146a- Make the first reconnection of a stream waitinitRetryTimeout, notinitRetryTimeout × backoffFactor -
#244
5963f54- Stop a stream with retries from reconnecting for ever when the response is not an event streamIt now fails with
SSE_INVALID_CONTENT_TYPEonce its retries are spent, without firingonOpen(). -
#244
4c28e42- ReplaceonError()and theerrorevent of streams withonRetry()onError()was only ever called when the stream was about to reconnect, never for an error ending it, which still only rejects the promisestart()returns.onRetry()is called at the same time with{ error, retryCount, maxRetryCount, retryAt },retryCountstarting at 1:-stream.onError((error) => showReconnecting(error, stream.retryCount + 1)); -stream.on('error', (event) => showReconnecting(event.data, stream.retryCount + 1)); +stream.onRetry(({ error, retryCount }) => showReconnecting(error, retryCount));
-
#244
4c28e42-pause()now works while a stream is connecting or retrying, and cancels the reconnectionIt can also be called from
onOpen()andonRetry()listeners. It still throws on a stream not started yet, already paused or closed. -
#244
6fc0102- Keep a stream open whenpause()andresume()are called in quick successionIt could close instead, usually rejecting the promise
start()returned with anAbortError. -
#244
4c28e42-stream.stateis nowretrying, notpaused, while a stream waits to reconnectpausednow only means the consumer paused the stream. Code readingpausedas "reconnecting" must readretrying:-if (stream.state === 'paused') showReconnecting(); +if (stream.state === 'retrying') showReconnecting();
-
#244
d4b08cd- Stop a stream from keeping a listener on thesignalof its request at each reconnection