hallowed-book-84502
09/01/2025, 7:44 AMtall-airline-16756
09/01/2025, 7:44 AMtall-airline-16756
09/01/2025, 7:44 AMhallowed-book-84502
09/01/2025, 7:45 AMtall-airline-16756
09/01/2025, 7:46 AMMath.random().toString(36).substring(7) and just tack it onto your room name. For example: `const roomName = `my-room-${Math.random().toString(36).substring(7)}`;`
• Custom Function: If you want something a bit more tailored, you can create a helper function to make random strings. Like this: `function randomString(length) {
const characters = 'abcdefghijklmnopqrstuvwxyz0123456789';
let result = '';
for (let i = 0; i < length; i++) {
result += characters.charAt(Math.floor(Math.random() * characters.length));
}
return result;
}
const roomName = `my-room-${randomString(6)}`;`
• Using LiveKit CLI: You can also use template strings like %x to add a random suffix. For example: lk token create --join --room "my-room-%x".
• Combining Timestamps: To make sure your room names are totally unique, try combining a timestamp with a random string like this: `const roomName = `user_12345_${Date.now()}_${randomString(4)}`;`
These little tricks help keep your room names unique and avoid any mix-ups with Room ID reuse. If you want me to walk you through any of these or have more questions, just let me know—I’m happy to help!
Sources: app/api/connection-details/route.ts | Avoiding Room ID Reuse When Re-Creating Rooms With the Same Name | ivr-nagivator/frontend/src/App.tsx | src/lib/controller.ts | cmd/lk/sip.gohallowed-book-84502
09/01/2025, 7:49 AMtall-airline-16756
09/01/2025, 7:49 AMhallowed-book-84502
09/01/2025, 7:52 AM