-
Notifications
You must be signed in to change notification settings - Fork 508
Stop sending the nick through data channels after some time #4182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stop sending the nick through data channels after some time #4182
Conversation
|
/backport to stable20 |
fd2dc4b to
8c0b33c
Compare
8c0b33c to
18cf0bc
Compare
|
@Ivansss please check if this works with apps? (I guess they would need adjustments?) |
Ivansss
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested and works 👍
"startSendingNick" is only used when the HPB is used, and only with the own peer, so there is no need to provide the peer as a parameter. Signed-off-by: Daniel Calviño Sánchez <[email protected]>
When the current participant is a guest the nick was always sent when another participant was connected. However, the nick is sent already (without HPB in the offer/answer, with HPB it is periodically sent), so there is no need to do it again. Signed-off-by: Daniel Calviño Sánchez <[email protected]>
Instead of sending "nickChanged" data channel messages from different places now an internal "nickChanged" event with the name is emitted, and its handler takes care of sending the data channel message as needed. This also fixes trying to send data channel messages to receiving only peers when the nick is changed and the HPB is used. Signed-off-by: Daniel Calviño Sánchez <[email protected]>
The function will be used to send both the media state and the nick, so its name is adjusted accordingly. Signed-off-by: Daniel Calviño Sánchez <[email protected]>
Since the introduction of the HPB the nick has been sent over and over again every second, as it is not possible to know when other participants have established a data channel connection. However, it is possible to know when other participants join the call, and it is safe to assume that the other participant established a connection with the local one after a "reasonable" amount of time. As sending the nick every second is too aggressive (specially in calls with a lot of users) now the nick is sent when the local participant establishes a connection with the remote one and, as that does not guarantee that the remote one has established a connection with the local one, the nick is sent again several times (with an increasing interval) in the next 30 seconds. If a connection is established with another participant in the meantime the cycle starts again. Signed-off-by: Daniel Calviño Sánchez <[email protected]>
The "userId" property was used only in CallParticipantModel, but as it is also set from the participant information provided by the signaling in most cases it is not needed. The only case in which it would be needed is if the Peer object is created and connected before the participant is found in the participant information provided by the signaling. However even in that rare case showing a user as a guest would happen very briefly and it will correct itself as soon as the signaling sends the participant information. Due to this, and as it will simplify also a "nickChanged" signaling message to be introduced later, the "userId" property is now ignored. Note that this only affects the internal "nick" event; the "userId" property still needs to be sent in the "nickChanged" data channel message as it is used by the Android app. Signed-off-by: Daniel Calviño Sánchez <[email protected]>
When the HPB is used, if the local participant does not send audio nor video there is no Peer for the local participant, so it is not possible to send data channel messages (although they can be received if the other participant sends audio or video and thus has a Peer object). When the HPB is not used, if both the local participant and the remote one do not send audio nor video there is no Peer for their connection, so it is not possible to send or received data channel messages between those participants. The nick was only sent through data channel messages, so in the above cases the nick was not initially shown and neither updated if it was changed later. Now a "nickChanged" signaling message is introduced to ensure that the nick is transmitted even if there is no Peer for a participant. Even if the mobile apps do not currently handle the "nickChanged" event they will just ignore it without breaking havoc. Signed-off-by: Daniel Calviño Sánchez <[email protected]>
When the HPB is not used the initial nick is sent along the offer and answer. However if there is no Peer between two participants there will be no offer/answer, so the nick needs to be explicitly sent in that case. Signed-off-by: Daniel Calviño Sánchez <[email protected]>
18cf0bc to
03d269b
Compare
|
Status? shall we merge it in 21 only so we test it a bit more? |
@PVince81 You self requested a review, should we wait for your review or should we merge? :-)
I would backport it to 20 already, but I am also fine with waiting until the next maintenance release. |
|
@danxuliu I've somehow deferred this as I wasn't sure whether you had other works in progress that would impact this PR, since you said you're going to revamp the "data channel" vs "signaling" vs ... stuff |
|
Ah, no, no, the revamp and fixes were going to be done after this was merged (or before it was merged but on top of this anyway, not by amending anything here). Sorry for the misunderstanding. |
PVince81
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 code looks fine with my limited knowledge
tested with and without signaling server with a guest whose nick changes, it seemed to work fine
I've added some optional comments
| return | ||
| } | ||
|
|
||
| this.set('userId', data.userid || null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
obsolete ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, see the commit description for details: e00f662
| // "webrtc.sendToAll" can not be used, as it only sends the signaling | ||
| // message to participants for which there is a Peer object, so the | ||
| // message may not be sent to participants without audio and video. | ||
| for (const sessionId in usersInCallMapping) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this something that we could put into a separate function to make it clearer ? or is this very specific to the nick use case ? (could be something for later)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I will address that when I fix the signaling messages for participants without Peer objects. So something for later :-)
Signed-off-by: Daniel Calviño Sánchez <[email protected]>
|
@PVince81 Comment added; if you are satisfied with it feel free to merge, otherwise please push fixup commits to improve it ;-) |
|
/backport to stable20.1 |
Requires #4181
(Kept as draft until #4181 is merged, but ready to review nevertheless)Since the introduction of the HPB the nick has been sent over and over again every second, as it is not possible to know when other participants have established a data channel connection (and neither to associate a signaling id with a Nextcloud id to get the nick from the participant list).
However, it is possible to know when other participants join the call, and it is safe to assume that the other participant established a connection with the local one after a "reasonable" amount of time.
As sending the nick every second is too aggressive (specially in calls with a lot of users) now the nick is sent when the local participant establishes a connection with the remote one and, as that does not guarantee that the remote one has established a connection with the local one, the nick is sent again several times (with an increasing interval) in the next 30 seconds. If a connection is established with another participant in the meantime the cycle starts again.
Additionally a
nickChangedsignaling message* is now sent along with the data channel message. The signaling message is needed for those cases in which there is no Peer object for a participant, as in that case it is not possible to send data channel messages. However, the data channel messages still need to be sent to keep compatibility with the mobile apps.*An unknown signaling message is just ignored by the mobile apps, but it should not break anything; tested in iOS by @Ivansss, although just my guess from checking the Android app code (but I have not actually tested it).