Overview
In-meeting chat has a single send API,sendRoomChatMessage, used for text, files, images, and voice alike.
The SDK doesn’t transfer files. ChatMsgType.File / Pic / Sound only tag the message type; msg is always a string,
and neither the SDK nor the server parses it. So sending a file takes three steps:
presignedPutObject(PresignedPutObjectType.Chat, ...)to get a signed upload URLPUTthe file to that URL yourself (the SDK doesn’t do this step)- Serialize the file info into a JSON string and send it with
sendRoomChatMessage(msg, ChatMsgType.File)
presignedGetObject(key) to get a download URL.
Send a text message
Must be called while in a meeting, otherwise it fails with “not in meeting”. The server rejects it when chat is disabled for the meeting or for you.
Send a file message
XMLHttpRequest or axios onUploadProgress; the URL and method stay the same.
presignedPutObject
Values of
PresignedPutObjectType:
msg format of file messages
The structure of msg is agreed between you and your own clients; the SDK doesn’t validate it. We recommend matching the official Web demo:
Add your own fields if you need more (such as image dimensions or voice duration); receivers just ignore fields they don’t recognize.
All your clients (Web / Android / iOS, etc.) must use the same
msg structure; otherwise the other side receives the message but can’t parse the file out of it.Receive messages
RoomChatMsgEventData:
uid equals your own), so don’t append them to the UI a second time.
Download a file
key (the first argument). The server doesn’t support the id parameter yet, so always pass resKey.
Fetch message history
People who join later don’t see earlier events; useroomChatMsgList to fetch them:
ChatMsgInfo:
Related reading
- SMeeting API
- Events —
ROOM_CHAT_MSGand chat-disabled state changes - Types —
ChatMsgType,PresignedPutObjectType