Hello there, I'm creating a livekit room using the...
# server-api
m
Hello there, I'm creating a livekit room using the server SDK, and setting the departure timeout to 180 seconds. I am doing this after ensuring the room does not exist (i call room delete with a 5s timeout before calling this). Strangely, when I check room properties with
lk room list
CLI command, I'm seeing that the departure timeout is 20 seconds. I tried this with different names & i keep getting 20 seconds for departure timeout.
➕ 1
👀 1
t
Hi Alex, I think that the issue might be that you're nesting departureTimeout within roomOptions. The example below (based on this, from the docs) worked for me:
Copy code
import { Room, RoomServiceClient } from 'livekit-server-sdk';
import 'dotenv/config';

// Access environment variables
const host = process.env.LIVEKIT_URL;
const apiKey = process.env.LIVEKIT_API_KEY; 
const apiSecret = process.env.LIVEKIT_API_SECRET;

// Initialize room service with credentials
const roomService = new RoomServiceClient(host, apiKey, apiSecret);

const opts = {
    name: 'test-room',
    departureTimeout: 180,
    maxParticipants: 20,
  };

roomService.createRoom(opts).then((room) => {
    console.log('Created room ', room.name);
});