sendPeerMessage abstract method
- ZIMMessage message,
- String toUserID,
- ZIMMessageSendConfig config
deprecated: This API has been deprecated since 2.4.0, please use sendMessage instead.
Available since: 2.1.5 and above.
Description: After this function is called, a message is sent to the specified user. At the same time, a ZIMMessageSentResult
callback is received, which can be used to determine whether the message is sent successfully.
Use cases: This function is used in 1V1 chat scenarios.
Call timing/Notification timing: Can be invoked after login.
Caution: Be aware of the ZIMMessageSentResult
callback when sending. This callback can be used to determine if the send fails for some reason.PushConfig Is required only when the offline push function is required.
Usage limit: no more than 10 /s, available after login, unavailable after logout.
Scope of influence: Using this method triggers the ZIMEventHandler.onReceivePeerMessage callback of the message receiver and the ZIMEventHandler.onConversationChanged callback of the sender and receiver. If message DND is not set for the session where the message is sent, Triggers ZIMEventHandler.onConversationTotalUnreadMessageCountUpdated callback.
Related callbacks:ZIMMessageSentResult
、ZIMEventHandler.onReceivePeerMessage、ZIMEventHandler.onConversationChanged、ZIMEventHandler.onConversationTotalUnreadMessageCountUpdated.
Related API: queryHistoryMessage、deleteAllMessage、deleteMessages
message
The message to be sent.
toUserID
The ID of the user who will receive the message.
config
Related configuration for sending single chat messages.
Implementation
/// Description: After this function is called, a message is sent to the specified user. At the same time, a [ZIMMessageSentResult] callback is received, which can be used to determine whether the message is sent successfully.
/// Use cases: This function is used in 1V1 chat scenarios.
/// Call timing/Notification timing: Can be invoked after login.
/// Caution: Be aware of the [ZIMMessageSentResult] callback when sending. This callback can be used to determine if the send fails for some reason.PushConfig Is required only when the offline push function is required.
/// Usage limit: no more than 10 /s, available after login, unavailable after logout.
/// Scope of influence: Using this method triggers the [ZIMEventHandler.onReceivePeerMessage] callback of the message receiver and the [ZIMEventHandler.onConversationChanged] callback of the sender and receiver. If message DND is not set for the session where the message is sent, Triggers [ZIMEventHandler.onConversationTotalUnreadMessageCountUpdated] callback.
/// Related callbacks:[ZIMMessageSentResult]、[ZIMEventHandler.onReceivePeerMessage]、[ZIMEventHandler.onConversationChanged]、[ZIMEventHandler.onConversationTotalUnreadMessageCountUpdated].
/// Related API: [queryHistoryMessage]、[deleteAllMessage]、[deleteMessages]
///
/// [message] The message to be sent.
/// [toUserID] The ID of the user who will receive the message.
/// [config] Related configuration for sending single chat messages.
Future<ZIMMessageSentResult> sendPeerMessage(
ZIMMessage message, String toUserID, ZIMMessageSendConfig config);