RTCMultiConnection
RTCMultiConnection copied to clipboard
'Userid already taken' in `connection.onUserIdAlreadyTaken`
"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);
};
closing socket is making problem
does anyone have alternative solution?
@grimace @grimace @muaz-khan @dansandland
"Userid already taken" After a short Internet disconnect, the user cannot join the room - is a big problem. The function
connection.onUserIdAlreadyTaken
from theRTCMultiConnection.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); };
closing socket is making problem