Skip to main content

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:
  1. presignedPutObject(PresignedPutObjectType.Chat, ...) to get a signed upload URL
  2. PUT the file to that URL yourself (the SDK doesn’t do this step)
  3. Serialize the file info into a JSON string and send it with sendRoomChatMessage(msg, ChatMsgType.File)
The receiver parses the JSON, and when downloading calls 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

To show upload progress, replace step 2 with XMLHttpRequest or axios onUploadProgress; the URL and method stay the same.

presignedPutObject

Values of PresignedPutObjectType:
When the deployment has file features turned off, presignedPutObject fails right away with 2125 (file features disabled); hide the send-file entry in chat in that case. The SDK doesn’t limit file size; enforce a per-file limit in your app.

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:
Messages you send also come back through this event (uid equals your own), so don’t append them to the UI a second time.

Download a file

Pass the 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; use roomChatMsgList to fetch them:
ChatMsgInfo:

  • SMeeting API
  • Events — ROOM_CHAT_MSG and chat-disabled state changes
  • Types — ChatMsgType, PresignedPutObjectType