stream filtering by connection id

This commit is contained in:
Jan Prochazka
2024-05-20 14:02:47 +02:00
parent df3313e647
commit 51d4bc9a75
5 changed files with 39 additions and 13 deletions

View File

@@ -77,6 +77,7 @@ function start() {
}
app.get(getExpressPath('/stream'), async function (req, res) {
const strmid = req.query.strmid;
res.set({
'Cache-Control': 'no-cache',
'Content-Type': 'text/event-stream',
@@ -87,9 +88,9 @@ function start() {
// Tell the client to retry every 10 seconds if connectivity is lost
res.write('retry: 10000\n\n');
socket.addSseResponse(res);
socket.addSseResponse(res, strmid);
onFinished(req, () => {
socket.removeSseResponse(res);
socket.removeSseResponse(strmid);
});
});