多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
``` /** * 房间ID生成函数 */ function generateRoomId() { var roomId = ""; for (var i = 0; i < 6; ++i) { roomId += Math.floor(Math.random() * 10); } return roomId; } //创建房间伪代码 let ret = null; //最多尝试10次 避免死循环 for(let i = 0; i < 10; ++i){ let roomId = generateRoomId(); let uuid = '' + Date.now() + roomId; let success = createRoom(uuid,roomId,roomConf); if(success){ ret = { uuid:uuid roomId:roomId, } break; } } if(ret){ //通知客户端创建成功 } else{ //通知客户端创建失败 } ```