Skip to content

Commit c0d1bfa

Browse files
committed
升级支持房间频道隔离
1 parent 9788a94 commit c0d1bfa

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

server/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ server.on('connection', (socket, request) => {
4141
if (urlWithPath.length > 1 && urlWithPath[1].length > 0 && urlWithPath[1].length <= 32) {
4242
roomId = urlWithPath[1];
4343
}
44+
if (roomId === 'ws') { // 兼容旧版本
45+
roomId = null;
46+
}
4447
const currentId = service.registerUser(ip, roomId, socket);
4548
// 向客户端发送自己的id
4649
socketSend_UserId(socket, currentId);

0 commit comments

Comments
 (0)