Skip to main content

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:
  1. Call presignedPutObject(type: .chat, ...) to get a signed upload URL
  2. PUT the file to that URL yourself (the SDK doesn’t do this step)
  3. Serialize {key, name, size} into a JSON string and send it with sendRoomChatMessage(_:type: .file)
The receiver parses the JSON in 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, presignedPutObject throws error code 2125 (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

The sender’s nickname isn’t in the event; look it up in the member list with uid:
If you echo the message locally right after it’s sent successfully, compare 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:
To receive:
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

Read the current state from RoomInfo.chatDisabled; when it changes, you receive:

Member level

Read the current state from MeetingUserInfo.chatDisabled; when it changes, you receive:
We recommend disabling the input box in the UI directly based on these two states, rather than waiting for sending to fail and then showing a message.