Open Msfrhdsa opened 3 days ago
The client creates multiple Websocket connections in parallel which all attempt to reconnect so the onClient and onOpen callbacks will be called multiple times. Note that you only send messages in the last created Websocket.
On server side you don't save clientSocket anywhere so it might be garbage collected at any point after the onClient callback finishes, probably preventing the onMessage callback to be called for all messages.
Even though they fire twice, onMessage only fires once for the client. Are all additional connections from a single client always closed? If so, why do clientSocket.onOpen and ws.onClient fire twice?
After starting the server, I start the client with multiple connections. After the client has connected, I kill the nodejs process and start it again. The client reconnects and in the server console I see onClient and onOpen triggering twice.
Node.js: v20.18.0 node-datachannel: 0.20.0 os: windows10 x64