@donkeylabs/server 2.0.4 → 2.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/core/sse.ts +4 -0
package/package.json
CHANGED
package/src/core/sse.ts
CHANGED
|
@@ -58,6 +58,10 @@ class SSEImpl implements SSE {
|
|
|
58
58
|
// Send retry interval to client
|
|
59
59
|
const retryMsg = `retry: ${this.retryInterval}\n\n`;
|
|
60
60
|
controller.enqueue(this.encoder.encode(retryMsg));
|
|
61
|
+
|
|
62
|
+
// Send immediate heartbeat to establish connection and prevent early timeout
|
|
63
|
+
const heartbeat = `: heartbeat ${Date.now()}\n\n`;
|
|
64
|
+
controller.enqueue(this.encoder.encode(heartbeat));
|
|
61
65
|
},
|
|
62
66
|
cancel: () => {
|
|
63
67
|
this.removeClient(id);
|