Fix websocket reconnection when a guest joins the conversation

When the standalone signaling server is used and a participant joins a
conversation a "join" signaling message is received. The code assumed
that the event always contains a "user" attribute, but that attribute is
empty for guests. As the "user" attribute was used unconditionally this
caused an exception, and as the exception happened when handling a
websocket message it propagated until it caused a reconnection of the
websocket.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit is contained in:
Daniel Calviño Sánchez 2020-10-01 13:45:20 +02:00
parent 93c12a89de
commit 6846eb950b

View File

@ -247,7 +247,10 @@ public class MagicWebSocketInstance extends WebSocketListener {
HashMap<String, Object> userMap = (HashMap<String, Object>) internalHashMap.get("user");
participant = new Participant();
participant.setUserId((String) internalHashMap.get("userid"));
participant.setDisplayName((String) userMap.get("displayname"));
if (userMap != null) {
// There is no "user" attribute for guest participants.
participant.setDisplayName((String) userMap.get("displayname"));
}
usersHashMap.put((String) internalHashMap.get("sessionid"), participant);
}
}