Skip to content
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

Send signaling messages when starting and stopping breakout rooms #8477

Conversation

danxuliu
Copy link
Member

@danxuliu danxuliu commented Dec 19, 2022

When the breakout room status changes a generic room message is sent to all the active sessions in either the parent or the breakout rooms (depending on whether they are being started or stopped) with the token of the room that they have to switch to.

🚧 TODO

  • Another possibility would have been to send a roomModified message including the breakout room status and then let each client figure which room they need to switch to. This could lead to a potential issue with guests in the future, as if the client has to figure the target room it would need to check all the conversation data to find the room, but guests can only get the data for the room they are in and that is it. However that could be simply fixable by also including the token of the assigned breakout room for the participant in the parent room data, so maybe it is better to let the clients figure where to switch to. The explicit message will be kept, as it could be used in other scenarios
  • Currently the session IDs are indexed by the token of the room that they have to switch to. An alternative would be to use each session as a key and the token of the room to switch to as the value; the benefit would be that this would make possible to send additional information, like the permissions that the participant will have in the target room. The drawback would be that the messages will be bigger, as the room token (and a label like token:) would be repeated for each session.
  • Adjust to format in Implement "switchto" support strukturag/nextcloud-spreed-signaling#409
  • Avoid showing the lobby screen for a moment when starting the breakout rooms - As a roomlist update event is sent when the lobby is modified and that event contains the up to date value of some properties, like the lobby state, the conversation data is now updated from the data in the event (besides still fetching again the conversation data from the server like before)
  • Keep the same media state (audio and video enabled or disabled) as before when joining the call after switching the conversation
  • Look for possible race conditions when handling the message in the clients - Switching to and from breakout rooms may not work as expected due to message/request order #8752

🏁 Checklist

@nickvergessen
Copy link
Member

As discussed:

  • Should switch to a map of session => room to be able to extend in the future
  • switchto event is fine as it allows other potential future use cases (adding someone to the call while being in a one-to-one)

@fancycode
Copy link
Member

From a quick look you are sending the whole mapping to the room which will be forwarded by the signaling server to each session in the room. Would it be better to add special handling to the signaling server, so that it parses the message and only sends each session an event that it should switch to a different room?

It's probably not necessary that each session knows which rooms the other sessions will switch to?

@danxuliu
Copy link
Member Author

danxuliu commented Jan 4, 2023

Sorry for the delay.

As discussed:

* Should switch to a map of session => room to be able to extend in the future

* switchto event is fine as it allows other potential future use cases (adding someone to the call while being in a one-to-one)

Done, but note that #8519 is needed to properly handle the event in the WebUI.

From a quick look you are sending the whole mapping to the room which will be forwarded by the signaling server to each session in the room. Would it be better to add special handling to the signaling server, so that it parses the message and only sends each session an event that it should switch to a different room?

It's probably not necessary that each session knows which rooms the other sessions will switch to?

Yes, explicit handling of the message in the signaling server would be great so each session only receives its own message, and also to replace the Nextcloud session ID with the signaling session ID. I used a generic message to avoid bothering you, but if you could add it to the signaling server it would be great :-) (and in worst case I could also try to add it myself... but you will be surely quicker ;-) ).

@nickvergessen nickvergessen mentioned this pull request Jan 4, 2023
60 tasks
@danxuliu danxuliu force-pushed the send-signaling-messages-when-starting-and-stopping-breakout-rooms branch 2 times, most recently from eb135dc to c03b8e1 Compare January 30, 2023 13:53
@fancycode
Copy link
Member

Would be good to check for the switchto feature flag here:

public function isCompatibleSignalingServer(IResponse $response): bool {

and here:
if (!this.hasFeature('audio-video-permissions') || !this.hasFeature('incall-all')) {

@danxuliu danxuliu force-pushed the send-signaling-messages-when-starting-and-stopping-breakout-rooms branch from 52d9112 to 584badc Compare January 31, 2023 03:45
@danxuliu
Copy link
Member Author

@nickvergessen When the breakout rooms were stopped the lobby was first enabled and then the breakout rooms were stopped. This caused a roomlist update event to be sent by the signaling with the new lobby state while the participants were in the room, so the participants were briefly in a room with the lobby enabled.

I have changed the order to first stop the breakout rooms and, then, do the needed cleanup (enable the lobby and remove the asisstance requests). However, is the previous order needed for some reason? Would that change break something?

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
When asserting that a message was sent to the signaling server all the
requests were validated before looking for the expected one. As the
requests include the token of the room all the requests were expected to
be sent to the same room; otherwise any request sent to other room would
make the assert fail. Now the requests to other rooms than the room of
the actual message being asserted are ignored, which will make possible
to sent messages to different rooms in the same test.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
When the breakout room status changes a "switchto" message is sent to
all the active sessions in either the parent or the breakout rooms
(depending on whether they are being started or stopped) with the token
of the room that they have to switch to.

When the breakout rooms are started the message is sent only to non
moderators, as moderators do not have a single breakout room assigned.
On the other hand, when the breakout rooms are stopped the message is
also sent to all moderators (who are in a breakout room and not already
in the parent room), as all participants need to switch to the parent
room.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
When the client receives a message to switch to a different room the
WebUI joins that room. If the WebUI was already in a call it will
automatically join the call in the target room; in that case the call
view will be kept shown during the switch, rather than showing the chat
while leaving the previous call and joining the new room to then show
the call again when joining the call in the target room.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
The external signaling server includes some room data in the "roomlist"
update event sent when a room is modified. That data is up to date, and
it will be the same received when fetching the room data again, so the
properties can be already updated in the store.

This prevents the lobby from being briefly shown when switching to a
breakout room due to the "switchto" message being handled before the
updated room data could be fetched from the server.

In order to keep the changes to a minimum note that this does was not
applied to guest users, as a different event seems to be sent in that
case, nor to the Talk sidebar, as the current properties provided in the
event should not be relevant to it.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
When the breakout rooms are stopped the lobby is enabled again in them.
However, as it was first enabled and then the breakout rooms were
stopped if the participants updated the room data before switching back
to the parent room the lobby was briefly shown. To prevent that the
breakout rooms should be stopped and, then, the lobby should be enabled
again.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
@danxuliu danxuliu force-pushed the send-signaling-messages-when-starting-and-stopping-breakout-rooms branch from 584badc to a46fa7e Compare January 31, 2023 04:02
@danxuliu danxuliu marked this pull request as ready for review January 31, 2023 04:03
@nickvergessen
Copy link
Member

I have changed the order to first stop the breakout rooms and, then, do the needed cleanup (enable the lobby and remove the asisstance requests). However, is the previous order needed for some reason? Would that change break something?

No internal reason in my side

foreach ($breakoutRooms as $breakoutRoom) {
$sessionIds = [];

$breakoutRoomParticipants = $participantService->getParticipantsForRoom($breakoutRoom);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#8660 brings in a getSessionsAndParticipantsForRooms so we can get them all with one query instead of a query per room
Maybe something for a follow up

@nickvergessen
Copy link
Member

Was not really successful in testing as the web totally does not work at the moment.
I couldn't even join a single call with 2 local clients, I guess my newly installed HPB is not working.

But yoloing for now

@nickvergessen nickvergessen merged commit a6e9b6e into master Feb 1, 2023
@nickvergessen nickvergessen deleted the send-signaling-messages-when-starting-and-stopping-breakout-rooms branch February 1, 2023 10:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants