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
When I tested the code below on versions 6.14.9 and 6.0.0, the response component didn´t call a close or abort event when the SSE client was closed.
When I tested the code below on version 5.9.2, the response component called an abort event when the SSE client was closed.
Test code - Server.js
const { Server } = require("hyper-express")
const crypto = require('crypto')
const server = new Server()
const sse_streams = {};
server.get('/news/events', (request, response) => {
// You may perform some authentication here as this is just a normal HTTP GET request
if (response.sse) {
response.sse.open();
response.sse.send('data: Some initial message \n\n');
response.sse.id = crypto.randomUUID();
sse_streams[response.sse.id] = response.sse;
console.log("New Connection - ID =",response.sse.id)
response.on('close', () => {
console.log("Close Connection - delete ID =", response.sse.id)
delete sse_streams[response.sse.id]
});
response.on('abort',() => {
console.log("Close Connection - Delete ID =", response.sse.id)
delete sse_streams[response.sse.id]
});
}
else {
console.log("Server-Sent Events Not Supported")
response.sse.send('data: Server-Sent Events Not Supported!\n\n');
}
});
server.listen(8000)
When I tested the code below on versions 6.14.9 and 6.0.0, the response component didn´t call a close or abort event when the SSE client was closed.
When I tested the code below on version 5.9.2, the response component called an abort event when the SSE client was closed.
Test code - Server.js
Test code - Client.js
The text was updated successfully, but these errors were encountered: