RTCMultiConnection icon indicating copy to clipboard operation
RTCMultiConnection copied to clipboard

https://github.com/muaz-khan/RTCMultiConnection/issues/683#issue-383053097

Open webleb opened this issue 2 years ago • 2 comments

closing socket is making problem does anyone have alternative solution?

webleb avatar Mar 27 '22 21:03 webleb

"Userid already taken" After a short Internet disconnect, the user cannot join the room - is a big problem. The function connection.onUserIdAlreadyTaken from the RTCMultiConnection.js library generates a new userID and tries join to the room:

connection.onUserIdAlreadyTaken = function(useridAlreadyTaken, yourNewUserId) { if (connection.enableLogs) { console.warn('Userid already taken.', useridAlreadyTaken, 'Your new userid:', yourNewUserId); } connection.userid = connection.token(); connection.join(connection.sessionid); }; But in a short time, the Signaling-Server.js server does not know that this user needs to be disabled, because Join does not work and the user does not connect.

I propose a solution In my case, it helps if connection.onUserIdAlreadyTaken closes a socket before connection.join:

connection.close (); connection.closeSocket (); Then, after connecting the Internet, the server will disconnect the user and after that the user will be able to join the room.

connection.onUserIdAlreadyTaken = function(useridAlreadyTaken, yourNewUserId) { if (connection.enableLogs) { console.warn('Userid already taken.', useridAlreadyTaken, 'Your new userid:', yourNewUserId); }

connection.close (); 
connection.closeSocket (); 

connection.userid = connection.token();
connection.join(connection.sessionid);

};

webleb avatar Mar 27 '22 21:03 webleb

This is not the best solution when there is more than 6 users the socket is closed on all users does anyone have better solution

webleb avatar Mar 27 '22 21:03 webleb