Send a non-OSS message
Send an image, audio, video, or file message whose media asset has already been uploaded to a remote URL.
Invoke sendMessageNotOss() to transmit media messages whose binary files have already been uploaded to your own application server or third-party storage, bypassing the SDK's built-in storage upload workflow. For plain text messages or media messages that reference local filesystem paths, use standard Send a message.
Parameters
The parameters match Send a message:
| Parameter | Type | Required | Description |
|---|---|---|---|
message | OpenIMMessageItem | Yes | Non-null message object generated by a URL-based creation method. |
recvID | string | Conditionally | Peer user ID for single chats; pass an empty string "" for group chats. |
groupID | string | Conditionally | Target group ID for group chats; pass an empty string "" for single chats. |
offlinePushInfo | OpenIMOfflinePush | null | No | Offline push title, description, and sound configuration; pass null for defaults. |
isOnlineOnly | boolean | No | When true, delivers exclusively to currently connected online devices without saving to local history. |
Code example
import { sendMessageNotOss } from '@/uni_modules/unix-openim-sdk'
const sentMessage = await sendMessageNotOss({
message: urlMessage,
recvID: receiverUserID,
groupID: '',
offlinePushInfo: null,
isOnlineOnly: false,
})
if (sentMessage.clientMsgID != null) {
replacePendingMessage(sentMessage.clientMsgID, sentMessage)
}The media URL, file size, dimensions, and duration must reflect actual remote storage metadata. This method does not upload binary data and fails if passed messages referencing un-uploaded local paths.
Return value
The Promise resolves with the sent OpenIMMessageItem. Update local optimistic state using clientMsgID. Delivery across remote devices and subsequent history queries represent separate phases and cannot be inferred solely from this call's success.
State changes after the call
This call sends the message directly to OpenIMServer without triggering local media progress events. Merge the returned OpenIMMessageItem into the local UI using clientMsgID.
Was this page helpful?