You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
...appears to do nothing, as the first line of the eventSource._close() method just returns immediately (and silently) if readyState is 2 (CLOSED). There's definitely some lousy code in the original module; I remember tearing my hair out trying to follow what it was doing with the error events (to solve the same problem you are dealing with here).
From the original:
EventSource.prototype.close = function () {
this._close()
}
this._close = function () {
if (readyState === EventSource.CLOSED) return
readyState = EventSource.CLOSED
if (req.abort) req.abort()
if (req.xhr && req.xhr.abort) req.xhr.abort()
}
The text was updated successfully, but these errors were encountered:
Yes, it does appear that close() would effectively result in a no-op by the way EventSource/eventsource implements it.
Keep in mind however that reconnecting-eventsource is a wrapper around EventSource as provided by the DOM (native code). EventSource/eventsource is a polyfill, and the behavior that you are describing is just how that polyfill happens to implement close().
I believe we are doing the right thing by calling close() on the old object before creating a new one in response to an error. Closing for now, but feel free to reopen if you have further comments/thoughts.
Inside _onerror:
this._eventSource.close();
...appears to do nothing, as the first line of the eventSource._close() method just returns immediately (and silently) if readyState is 2 (CLOSED). There's definitely some lousy code in the original module; I remember tearing my hair out trying to follow what it was doing with the error events (to solve the same problem you are dealing with here).
From the original:
EventSource.prototype.close = function () {
this._close()
}
this._close = function () {
if (readyState === EventSource.CLOSED) return
readyState = EventSource.CLOSED
if (req.abort) req.abort()
if (req.xhr && req.xhr.abort) req.xhr.abort()
}
The text was updated successfully, but these errors were encountered: