Skip to content

Commit ed4a992

Browse files
committed
Bugfix/26 simulated without data (#33)
* Fixed the bug from issue #26.
1 parent b5d30d9 commit ed4a992

File tree

4 files changed

+7
-1
lines changed

4 files changed

+7
-1
lines changed

lib/projects/ngx-sse-client/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,10 @@ this.sseClient.stream('/subscribe', { responseType: 'text' }).subscribe((data) =
110110
111111
## CHANGELOG
112112

113+
### 19.0.2
114+
115+
- fixed the issue when `data` of message with any `falsy` value.
116+
113117
### 19.0.1
114118

115119
- fixed server response ends with non descript error on `keepAlive` _false_.

lib/projects/ngx-sse-client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ngx-sse-client",
3-
"version": "19.0.1",
3+
"version": "19.0.2",
44
"description": "A simple SSE (Server Sent Events) client for Angular applications.",
55
"keywords": [
66
"angular",

lib/projects/ngx-sse-client/src/lib/sse-client-subscriber.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ export class SseClientSubscriber {
6969
}
7070

7171
private onStreamProgress(data: string, observer: Subscriber<string>): void {
72+
if(!data) return;
7273
data = data.substring(this.progress);
7374
this.progress += data.length;
7475
data.split(/(\r\n|\r|\n){2}/g).forEach((part) => this.parseEventData(part, observer));

server/server.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ app.get('/subscribe', (req, res) => {
2626
res.header('Access-Control-Allow-Origin', '*');
2727
res.on('close', () => removeEmitters([emitter]));
2828
res.flushHeaders();
29+
res.write(`${END_CONTENT}`);
2930

3031
emitters.push(emitter);
3132
console.info(`SUBSCRIBED ID ${emitter.id}`);

0 commit comments

Comments
 (0)