RTCMultiConnection: initiator can't rejoin a room after leaving connection
Hi,
My problem is :
If a participant leaves the connection (by refreshing the page for example), he can reconnect to the same connection.
But if the initiator leaves the connection (by refreshing the page for example), the messages are not sent to the participants until they reconnect themselves (participants array is empty).
Her is the code:
// Initialization
connection = new RTCMultiConnection(channel_ID)
connection.socketURL = '/'
connection.autoCloseEntireSession = false
connection.onmessage = onmessage
connection.sessionid = channel_ID
connection.socketCustomEvent = 'custom-message'
// Connection
connection.openOrJoin(channel_ID, function() {
})
Did I missed something?
About this issue
- Original URL
- State: open
- Created 7 years ago
- Reactions: 2
- Comments: 23 (3 by maintainers)
Commits related to this issue
- #428 also added support for MSEdge-Screen-Capturing Now you can set passwords using "connection.password". Now if initiator leaves, he can rejoin same room. — committed to muaz-khan/RTCMultiConnection by muaz-khan 6 years ago
- New Release: RTCMultiConnection 3.4.7 Closed #639, Fixed ##428, Fixed ##638 For more info, please check: #639 — committed to muaz-khan/RTCMultiConnection by muaz-khan 6 years ago
I’m working on storing room-ids on the nodejs as well. So one will join a room based on room-id; not based on initiator’s user-id. checkPresence method will also check for room-id instead of initiator’s id. So initiator or any person can leave or rejoin without affecting the room on nodejs.
I was able to fix this issue for me by changing a line in the Signaling-Server.js file.
if (autoCloseEntireSession == 'false' && sessionid == socket.userid) { socket.shiftModerationControlBeforeLeaving = true; }Line 97
to
if (autoCloseEntireSession == 'false' && Object.keys(listOfUsers).length == 1) { socket.shiftModerationControlBeforeLeaving = true; }There is probably a better way to do this but the issue was in essence that the userid recieved from socket.handshake.query wasn’t equal to the sessionid for the first user to join at this point in the code (but it does get set to the sessionid later from what I can tell) and instead was a randomly generated userid like everyone who joined afterwards. This will make is so when the initiator leaves, the next user in listOfUsers will inherit the initiator status and when the original initiator joins back it will be like they are joining as a normal user.
This feels like a bit of a hacky solution, and considering that it works properly in the web demos, I’m fairly certain there’s a better fix, but this worked for me.
This issue will be fixed soon. Just working on that now.
I’m still scratching my head trying to figure out what Muaz’s goal is in all of this? Granted, I admire his ambition and him providing all of the neat code, but since there are no comments in the code, and I consider myself very green with WebRTC, I am struggling to get anything to work correctly. Right now I am playing with Multiple-Broadcasters-Many Viewers. Very complex code. It does not work as I might expect and there are major issues. As Muaz rarely answers questions, is it entirely up to us to find and fix bugs? If that’s the case, I guess I’m screwed as it will take me quite a long time to figure out the code. Reporting the issues are not getting anywhere. Aren’t demos supposed to work by default?
I do not believe another should become initiator. That defeats the purpose of being the initiator! However, the original initiator should be able to rejoin the conference for sure. That said, after the conference is started, what does the initiator have to do anyway?