Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejs
themeRDark
addMessage(participant.name(), encodeURIComponent(message));

and decodeURIComponent() while receiving message

Code Block
languagejs
themeRDark
       ...
 var participants = }).on(ROOM_EVENT.MESSAGE, function(message){room.getParticipants();
        addMessage(message.from.name(), decodeURIComponent(message.textfor (var i = 0; i < participants.length; i++) {
            participants[i].sendMessage(encodeURIComponent(message));
        });

and decodeURIComponent() while receiving message

Code Block
languagejs
themeRDark
    ...
    }).on(ROOM_EVENT.MESSAGE, function(message){
        addMessage(message.from.name(), decodeURIComponent(message.text));
    });
    ...

2. When connection.join() and then room.leave() are called too fast. it is possible to send join command to the server while it still handles previous leave command for this user

Symptoms: when connection.join() is called right after room.leave(), client may receive a message

Code Block
themeRDark
Room already has user with such login

Solution: use at least 1 second interval between room.leave() and connection.join() subsequent calls