ITADN

departureTimeout and emptyTimeout are ignored for RoomServiceClient.createRoom

#578OpenSkytuna 创建于 2025-11-26
S
Skytunacommented
### Select which package(s) are affected livekit-server-sdk ### Describe the bug ### Description While testing LiveKit with a minimal Node.js API setup, I noticed that the `departureTimeout` and `emptyTimeout` room configuration values appear to be ignored. Regardless of the values I pass in, the room uses the default values. ### What I Expected `departureTimeout` and `emptyTimeout` should use the given values. ### What Actually Happened Default values are returned for `departureTimeout` and `emptyTimeout`. <img width="397" height="256" alt="Image" src="https://github.com/user-attachments/assets/f67b4941-0c56-43f9-9e44-58da7c3a79df" /> ### Reproduction ```js const express = require('express'); const cors = require('cors'); const bodyParser = require('body-parser'); const { AccessToken, RoomServiceClient } = require('livekit-server-sdk'); const LIVEKIT_API_KEY = 'key'; const LIVEKIT_API_SECRET = 'secret'; const LIVEKIT_URL = 'wss://url'; if (!LIVEKIT_URL || !LIVEKIT_API_KEY || !LIVEKIT_API_SECRET) { console.error('Please set LIVEKIT_URL, LIVEKIT_API_KEY and LIVEKIT_API_SECRET'); process.exit(1); } const app = express(); app.use(cors()); app.use(bodyParser.json()); const roomSvc = new RoomServiceClient(LIVEKIT_URL, LIVEKIT_API_KEY, LIVEKIT_API_SECRET); app.post('/token', async (req, res) => { try { const { room, identity, name } = req.body; if (!room || !identity) return res.status(400).json({ error: 'room and identity required' }); const at = new AccessToken(LIVEKIT_API_KEY, LIVEKIT_API_SECRET, { identity, name }); at.addGrant({ roomJoin: true, room: room, }); const token = await at.toJwt(); res.json({ token, livekitUrl: LIVEKIT_URL }); } catch (err) { console.error(err); res.status(500).json({ error: err.message }); } }); app.post('/rooms', async (req, res) => { try { const { name } = req.body; if (!name) return res.status(400).json({ error: 'name required' }); const room = await roomSvc.createRoom({ name, departureTimeout: 10, emptyTimeout: 30 }); // timeouts are ignored? res.json(room); } catch (err) { console.error(err); res.status(500).json({ error: err.message }); } }); app.get('/rooms', async (req, res) => { try { const resp = await roomSvc.listRooms(); res.json(resp.rooms || resp); } catch (err) { console.error(err); res.status(500).json({ error: err.message }); } }); const port = process.env.PORT || 3001; app.listen(port, () => console.log(`Server running on ${port}`)); ``` ### System Info ```shell System: OS: Windows 11 10.0.26100 CPU: (12) x64 AMD Ryzen 5 7600X 6-Core Processor Memory: 16.22 GB / 31.10 GB Binaries: Node: 20.18.1 - C:\Program Files\nodejs\node.EXE npm: 10.8.2 - C:\Program Files\nodejs\npm.CMD npmPackages: livekit-server-sdk: ^2.14.2 => 2.14.2 ``` ### LiveKit server version LiveKit cloud ### Severity serious, but I can work around it
0 条评论