feat: Dynamically fetch TURN credentials, improve WebRTC connection stability with ICE restart logic, and configure TURN via environment variables.
This commit is contained in:
@@ -7,8 +7,15 @@ const io = new Server(server);
|
||||
|
||||
// Password setting via environment variable, defaulting to "secret"
|
||||
const BROADCASTER_PASSWORD = process.env.BROADCASTER_PASSWORD;
|
||||
const TURN_USER = process.env.TURN_USER || 'myuser';
|
||||
const TURN_PASSWORD = process.env.TURN_PASSWORD || 'mypassword';
|
||||
let broadcasterSocketId = null;
|
||||
|
||||
// Serve TURN credentials to clients
|
||||
app.get('/turn-config', (req, res) => {
|
||||
res.json({ username: TURN_USER, credential: TURN_PASSWORD });
|
||||
});
|
||||
|
||||
app.use(express.static("public"));
|
||||
|
||||
io.on("connection", (socket) => {
|
||||
|
||||
Reference in New Issue
Block a user