I am using socket.io v4.5.1 and tried running this code from the client side:
createButtonSecond.addEventListener("click", createButtonSecondClick);
function createButtonSecondClick() {
hide(createRoomSecond)
unhide(shareCode);
setRoom(code);
setCross(symbol.value);
setFirstPlayer(firstPlayer.value);
const obj = {}
obj.room = room;
obj.cross = cross;
obj.firstPlayer = firstPlayer;
socket.emit("create-room", obj); // this is where the problem occurs
}
My goal was to pass all three info to the server. But whenever I try passing more than 2 info, I get Uncaught RangeError: Maximum call stack size exceeded. This also happens when I try doing something like
socket.emit("create-room", room, cross, firstPlayer);
but it doesn't happen when I try
socket.emit("create-room", room, cross);
I even tried doing
socket.emit("create-room", room);
socket.emit("create-room-cross", cross);
socket.emit("create-room-firstPlayer", firstPlayer);
but still the issue persists. I searched socket docs but couldn't find anything. What might be the issue?