Closed axacheng closed 2 years ago
Hi @axacheng, if you terminate the stream after 60 seconds, should the client be allowed to reconnect immediately? If not, you will need to write you own logic to allow or disallow certain requests. That would be out of the scope of this module.
Here's an example that allows or disallows access to the stream:
const express = require('express');
const app = express();
const { proxy } = require('rtsp-relay')(app);
app.ws('/api/stream', (ws, req) => {
if (!isAuthenticated(req)) {
// NOT authenticated. do not allow access to stream
return;
}
return proxy({ url: 'rtsp://1.2.3.4/cam1' })(ws);
});
ah~ awesome! I was also thinking to implement Auth Bearer header to do so, but would be nice to check with you first.
Thank you so much
I'd like to stream ffmpeg output in just 60 seconds for every web client connections. I've tried ws.close() or ws.terminate() that closed the connection but rtsp-relay built-in function did reconnect, so web client still can see proxy({}) output. Could you please provide a code example to terminate connection?
Thanks