mirror of
https://github.com/darkwire/darkwire.io.git
synced 2025-07-18 18:54:52 +00:00
Send unhashed room ID
This commit is contained in:
parent
8614530163
commit
76baec6b5d
@ -21,24 +21,9 @@ export default class Socket {
|
|||||||
async init(opts) {
|
async init(opts) {
|
||||||
const { roomId, socket, room } = opts
|
const { roomId, socket, room } = opts
|
||||||
await this.joinRoom(roomId, socket.id)
|
await this.joinRoom(roomId, socket.id)
|
||||||
this.sendRoomInfo();
|
|
||||||
this.handleSocket(socket)
|
this.handleSocket(socket)
|
||||||
}
|
}
|
||||||
|
|
||||||
sendRoomInfo() {
|
|
||||||
let room;
|
|
||||||
if (_.isEmpty(this.room)) {
|
|
||||||
room = {
|
|
||||||
id: this.roomIdOriginal,
|
|
||||||
users: [],
|
|
||||||
isLocked: false,
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
room = this.room;
|
|
||||||
}
|
|
||||||
this.socket.emit('CONNECTED', room);
|
|
||||||
}
|
|
||||||
|
|
||||||
sendRoomLocked() {
|
sendRoomLocked() {
|
||||||
this.socket.emit('ROOM_LOCKED');
|
this.socket.emit('ROOM_LOCKED');
|
||||||
}
|
}
|
||||||
@ -100,7 +85,10 @@ export default class Socket {
|
|||||||
}
|
}
|
||||||
await this.saveRoom(newRoom)
|
await this.saveRoom(newRoom)
|
||||||
|
|
||||||
getIO().to(this._roomId).emit('USER_ENTER', newRoom);
|
getIO().to(this._roomId).emit('USER_ENTER', {
|
||||||
|
...newRoom,
|
||||||
|
id: this.roomIdOriginal
|
||||||
|
});
|
||||||
})
|
})
|
||||||
|
|
||||||
socket.on('TOGGLE_LOCK_ROOM', async (data, callback) => {
|
socket.on('TOGGLE_LOCK_ROOM', async (data, callback) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user