Skip to content

Commit f07039f

Browse files
committed
Fix handling of signaling message responses when joining a room
When joining a room, the signaling server confirms that joining the room was successful by sending a "room" message. Until now the Android app assumed that "room" messages were sent only in that case, but a "room" message can be sent also if the properties of the room change. When the room is joined while the call activity is active the call is also joined, so if the properties of the room changed while in a call the Android app rejoined the call, which caused strange issues due to how it was done. For example, when a recording started additional guests appeared in the UI. To solve that now only the "room" message that actually confirms that the join was successful, which can be identified by setting an ID in the request to join the room, is treated as such. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
1 parent 947ada1 commit f07039f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

app/src/main/java/com/nextcloud/talk/webrtc/WebSocketInstance.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,6 @@ class WebSocketInstance internal constructor(
165165
when (messageType) {
166166
"hello" -> processHelloMessage(webSocket, text)
167167
"error" -> processErrorMessage(webSocket, text)
168-
"room" -> processJoinedRoomMessage(text)
169168
"event" -> processEventMessage(text)
170169
"message" -> processMessage(text)
171170
"bye" -> {
@@ -396,11 +395,14 @@ class WebSocketInstance internal constructor(
396395
Log.d(TAG, " session: $normalBackendSession")
397396
try {
398397
val message = webSocketConnectionHelper.getAssembledJoinOrLeaveRoomModel(roomToken, normalBackendSession, federation)
398+
val processJoinedRoomMessageCallback = { text: String ->
399+
processJoinedRoomMessage(text)
400+
}
399401
if (roomToken == "") {
400402
Log.d(TAG, "sending 'leave room' via websocket")
401403
currentNormalBackendSession = ""
402404
currentFederation = null
403-
sendMessage(message)
405+
sendMessage(message, processJoinedRoomMessageCallback)
404406
} else if (
405407
roomToken == currentRoomToken &&
406408
normalBackendSession == currentNormalBackendSession &&
@@ -413,7 +415,7 @@ class WebSocketInstance internal constructor(
413415
Log.d(TAG, "Sending join room message via websocket")
414416
currentNormalBackendSession = normalBackendSession
415417
currentFederation = federation
416-
sendMessage(message)
418+
sendMessage(message, processJoinedRoomMessageCallback)
417419
}
418420
} catch (e: IOException) {
419421
Log.e(TAG, "Failed to serialize signaling message", e)

0 commit comments

Comments
 (0)