Skip to main content

Sending a chat message

As mentioned in introduction, there are 3 types of chat messages - text messages, images, and files. There is a method in to send a message of each type.

Send a text message

To send a text message, the method can be used. This accepts a string message and sends it to the room.

const message = 'Is this the real life?';

Send an image

You can send an image with the help of This accepts an image of type File, and sends it to the participants in the meeting.

async function onSendImage() {
const image = {
uri: image.uri,
size: image.size,
type: image.type,

Send a file

Sending a file is quite similar to sending an image. The only difference is that when you send an image, a preview will be shown in the meeting chat, which is not the case for sending files. That being said, an image can be sent as a file too using

async function onSendFile() {
const file = {
uri: file.uri,
size: file.size,
type: file.type,


There is also a common method called that can be used to send any of the 3 types of messages displayed above. It essentially calls one of the methods from above depending upon the type of payload you send to the method. The sendMessage() method accepts a parameter message of the following type:

async function sendMessage(
message: { type: 'text', message: string }
| { type: 'image', image: File }
| { type: 'file', file: File },
) {...}

Here's how you would use the sendMessage() method to send a text message.

const message = 'Is this just fantasy?';
await{ type: 'text', message });