Skip to content

Commit

Permalink
bug: issues with room full, will check later
Browse files Browse the repository at this point in the history
  • Loading branch information
zrthxn committed Sep 23, 2021
1 parent 0ddeae3 commit 83c6c9c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion backend/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ import RoomHandler from './sockets/rooms';
const SOCKPORT = 4050;
const { listen, emit } = EVENTS;

const sock = new Server(SOCKPORT);
const sock = new Server(SOCKPORT, {
cors: { origin: "*", allowedHeaders: "*", methods: "*" },
});

console.log(`[Starting] Socket PORT ${SOCKPORT}`)

Expand Down
4 changes: 2 additions & 2 deletions backend/src/sockets/players.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ const PlayerHandler = (player: Socket) => {
if (room.exists) {
let { population, players } = (room.data() || {}) as IRoom;

if (population >= 2)
return player.emit(emit.ERROR, "Room full")
// if (population >= 2)
// return player.emit(emit.ERROR, "Room full")

player.join(roomId);
player.to(roomId).emit(emit.ROOM.JOINED, player.id);
Expand Down

0 comments on commit 83c6c9c

Please sign in to comment.