|
@@ -25,6 +25,7 @@ module.exports = class WebSocketServer {
|
|
|
let user = socket.handshake.query
|
|
|
this._users.push(user)
|
|
|
const roomId = user['roomId']
|
|
|
+ console.log(user)
|
|
|
socket.join(roomId, () => {
|
|
|
let roomsPerson = this._roomPerson.get(roomId) || []
|
|
|
roomsPerson.push(user)
|
|
@@ -57,6 +58,7 @@ module.exports = class WebSocketServer {
|
|
|
// 断开连接的把roomsPerson中的user去掉
|
|
|
roomsPerson = roomsPerson.filter(item => item !== user)
|
|
|
this._roomPerson.set(roomId, roomsPerson)
|
|
|
+ this.io.to(roomId).emit('vr_request', { persons: roomsPerson.filter(item => !item.isClient) });
|
|
|
console.log("关闭连接", reason);
|
|
|
});
|
|
|
socket.on("error", function (reason) {
|
|
@@ -64,7 +66,7 @@ module.exports = class WebSocketServer {
|
|
|
});
|
|
|
return this;
|
|
|
|
|
|
- });
|
|
|
+ })
|
|
|
|
|
|
}
|
|
|
|