Conversation

Here is a description of the different steps to create a groupChat communication:

Send a message to the conversation

Once you have joined a conversation, you will be able to send a message to everyone in it:
        //Wrapper to send a message to everyone in the conversation and display sent message in UI
        function sendMessageToActiveConversation(message) {
            //send message to users in Conversation
            activeConversation.sendMessage(message);
        }
    

Add events listeners on Conversation

Add listener on 'message' to manage message display :

        //Listen to incoming messages from conversation
        activeConversation.on('message', function(e) {
            //Manage the display of message
            //To get the sender id use : e.sender.getId()
            //To get the message use : e.content
        });
    

Listen for any participants entering or leaving the conversation

You can use Conversation.getContacts() to get every participant in Conversation

        activeConversation.on('contactJoined', function(contact) {
            console.log("Contact that has joined :", contact);
        })
        .on('contactLeft', function(contact) {
            console.log("Contact that has left :", contact);
        });
    

Live Demo