jabyrd3 / typeto.me2

Successor to typeto.me
8 stars 3 forks source link

crash when 3rd person leaves #27

Open dmd opened 7 months ago

dmd commented 7 months ago

Sometimes when a third person (who got an error) closes their window:

2024-01-30T22:52:04.116839149Z Listening on http://localhost:8089/
2024-01-30T22:52:04.119220603Z Listening on http://localhost:8090/
2024-01-30T22:52:06.489355586Z a client connected!
2024-01-30T22:52:06.513342396Z socket requested nonexistent room, creating one
2024-01-30T22:52:06.513684081Z socket id 9a3cd2022d46843206cc joining room f4b0c3, there are already 0 sockets connected
2024-01-30T22:52:09.250583747Z a client connected!
2024-01-30T22:52:09.271192905Z socket id 34d7f0409d455755a8da joining room f4b0c3, there are already 1 sockets connected
2024-01-30T22:52:13.517768526Z socket id 9a3cd2022d46843206cc closed
2024-01-30T22:52:13.578589454Z a client connected!
2024-01-30T22:52:13.602204425Z socket id 9a3cd2022d46843206cc joining room f4b0c3, there are already 1 sockets connected
2024-01-30T22:52:14.130553277Z changes have been made since the last write, caching undeleted conversations
2024-01-30T22:52:27.344836487Z socket id 34d7f0409d455755a8da closed
2024-01-30T22:52:27.359329967Z a client connected!
2024-01-30T22:52:27.378579053Z socket id 34d7f0409d455755a8da joining room f4b0c3, there are already 1 sockets connected
2024-01-30T22:52:30.286323831Z socket id 34d7f0409d455755a8da closed
2024-01-30T22:52:30.393413283Z a client connected!
2024-01-30T22:52:30.413462035Z socket id 34d7f0409d455755a8da joining room f4b0c3, there are already 1 sockets connected
2024-01-30T22:52:34.134283806Z changes have been made since the last write, caching undeleted conversations
2024-01-30T22:52:35.793460365Z a client connected!
2024-01-30T22:52:35.817045972Z socket id 09c3ffca59e648d4af21 joining room f4b0c3, there are already 2 sockets connected
2024-01-30T22:52:37.524997145Z socket id 09c3ffca59e648d4af21 closed
2024-01-30T22:52:37.531074673Z error: Uncaught TypeError: Cannot read properties of undefined (reading 'push')
2024-01-30T22:52:37.531108093Z     this.messages[id].push(`> socket id ${id} has left at ${new Date().toLocaleString("en-US", {
2024-01-30T22:52:37.531112826Z                       ^
2024-01-30T22:52:37.531116862Z     at Room.leave (file:///app/index.ts:81:23)
2024-01-30T22:52:37.531121602Z     at WebSocket.<anonymous> (file:///app/index.ts:238:33)
2024-01-30T22:52:37.531127454Z     at innerInvokeEventListeners (ext:deno_web/02_event.js:754:7)
2024-01-30T22:52:37.531132070Z     at invokeEventListeners (ext:deno_web/02_event.js:801:5)
2024-01-30T22:52:37.531136839Z     at dispatch (ext:deno_web/02_event.js:658:9)
2024-01-30T22:52:37.531155109Z     at WebSocket.dispatchEvent (ext:deno_web/02_event.js:1043:12)
2024-01-30T22:52:37.531159647Z     at WebSocket.[[[eventLoop]]] (ext:deno_websocket/01_websocket.js:493:16)
2024-01-30T22:52:37.531164087Z     at eventLoopTick (ext:core/01_core.js:182:7)

I suspect the problem is that two users using the same browser (i.e., me testing on one computer) are actually getting the same socket id? Because ... shared connection? idk how this works.