Conversation, chat, file transfer

This demo exposes the video conference with the chat and file transfer options

Start and join conversation

Check our conversation tutorial to get more details.

Send a message to the conversation

Once you have joined a conversation, you will be able to send a message to everyone in it:

    connectedConversation.sendMessage(message);
    

Add message event listener to handle incoming message:

    connectedConversation.on('message', (msg) => {
        console.log('Chat message :', msg);
    });
    

Listen for any participants entering or leaving the conversation. You can use Conversation.getContacts() to get every participant in Conversation.

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

File transfer

Check API reference to get more details about pushData method.

    connectedConversation.pushData({'file': file})
        .then((cloudMediaInfo) => {
            console.log('File uploaded :', cloudMediaInfo);
        })
        .catch((err) => {
            console.log('File uploading error :', err);
        });
    

Add file transfer events listeners:

    connectedConversation.on('transferBegun', () => {
        console.log('Transfer begun');
    });
    connectedConversation.on('transferProgress', (progress) => {
        console.log('Progress:', progress.percentage)
    });
    connectedConversation.on('transferEnded', () => {
        console.log('Transfer ended');
    });
    

Live Demo