diff --git a/server/src/socket.js b/server/src/socket.js index 1c7db12..9570753 100644 --- a/server/src/socket.js +++ b/server/src/socket.js @@ -21,24 +21,9 @@ export default class Socket { async init(opts) { const { roomId, socket, room } = opts await this.joinRoom(roomId, socket.id) - this.sendRoomInfo(); 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() { this.socket.emit('ROOM_LOCKED'); } @@ -100,7 +85,10 @@ export default class Socket { } 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) => {