socketio_1 | /code/server.js:192
socketio_1 | const chair = ( user.id == hosts[i][0].id );
socketio_1 | ^
socketio_1 |
socketio_1 | TypeError: Cannot read properties of undefined (reading 'id')
socketio_1 | at leaveRoom (/code/server.js:192:24)
socketio_1 | at Socket.<anonymous> (/code/server.js:299:3)
socketio_1 | at Socket.emit (node:events:527:28)
socketio_1 | at /code/node_modules/socket.io/lib/socket.js:528:12
socketio_1 | at processTicksAndRejections (node:internal/process/task_queues:78:11)
socketio_1 |
socketio_1 | Node.js v17.7.1
Reproduce the case:
I have a presentation that allows the host to login (enter PW) and also to leave the hosting. The guests have also two buttons that allow to join (RevealSeminar.join_room();) and unjoin the room (RevealSeminar.leave_room();)
one computer opens the presentation and connects as a host
another computer opens the presentation and clicks to unjoin the room (he wasn't joined before)
--> this reproduces the error at source code line 192
I assume that the variable user (host respectively) are empty and therefore the 'id' can not be accessed. What would be the best remediation ? Try-catch?
Hi I had quite a lot of crashes with socket.io server. Unfortunately I am not at all a JavaScript person and thus a little bit lost.
I have the followings:
and also at another place:
Reproduce the case:
I assume that the variable user (host respectively) are empty and therefore the 'id' can not be accessed. What would be the best remediation ? Try-catch?
Thanks for your help