Skip to content

Commit

Permalink
fix: only markClose once on completion of request (fixes #74)
Browse files Browse the repository at this point in the history
  • Loading branch information
mpetazzoni committed Jul 22, 2024
1 parent efb81be commit 0bfb307
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/sse.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@ var SSE = function (url, options) {
// Parse the last chunk.
this.dispatchEvent(this._parseEventChunk(this.chunk));
this.chunk = '';

this._markClosed();
};

/**
Expand Down Expand Up @@ -273,8 +275,6 @@ var SSE = function (url, options) {
event.headers = headers;
this.dispatchEvent(event);
this._setReadyState(this.OPEN);
} else if (this.xhr.readyState === XMLHttpRequest.DONE) {
- this._markClosed();
}
};

Expand Down

1 comment on commit 0bfb307

@br-kwon
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi @mpetazzoni , we are looking forward to this fix in our app - wondering when we might be able to get this in an officially released version, thanks!

Please sign in to comment.