Overview
There are two kinds of messages inside a meeting, and both work only during the meeting:
Both support sending to everyone and private messages: pass
nil for targetId to send to everyone, or a member’s uid to send privately.
Calling them when not in a meeting throws SMeetingError.notInMeeting.
Send chat messages
ChatMsgType values: .text (default), .file, .pic, .sound. The SDK doesn’t upload or download the file itself; it only delivers the message content, and how to render it is up to your UI.
Send file messages
Since 1.12.0,PresignedPutObjectType.chat lets you upload chat files straight to the meeting’s object storage. It takes three steps:
- Call
presignedPutObject(type: .chat, ...)to get a signed upload URL PUTthe file to that URL yourself (the SDK doesn’t do this step)- Serialize
{key, name, size}into a JSON string and send it withsendRoomChatMessage(_:type: .file)
msg and, when downloading, gets a URL from the key on demand:
{key, name, size} is the format used by the official Web Demo and Swift Demo. The SDK doesn’t validate it, so you can also agree on your own format across your clients.
When the deployment has file features turned off,presignedPutObjectthrows error code2125(file features are disabled); hide the send-file entry in that case. The SDK doesn’t limit file size, so enforce a per-file limit in your app.
Receive chat messages
uid:
data.uid with meeting.currentUserId to deduplicate, so the same message isn’t shown twice.
Custom messages
The content of a custom message is a string, usually your own JSON:Custom messages are a path for your own use; the SDK’s own meeting signaling goes over a separate path, so your message content never conflicts with the SDK.
Disable chat
Chat can be disabled at the room level and at the member level, both set by the host / a co-host.Room level
RoomInfo.chatDisabled; when it changes, you receive:
Member level
MeetingUserInfo.chatDisabled; when it changes, you receive: