Set global message reception
Set the current account’s default message reception and notification behavior for all conversations.
globalRecvMsgOpt is the account-level default. It controls whether the current account receives messages and allows notifications; it is separate from ordinary profile fields such as nickname and avatar.
import { MessageReceiveOption } from '@openim/wasm-client-sdk';
await openimsdk.setSelfInfo({
globalRecvMsgOpt: MessageReceiveOption.ReceiveWithoutNotification,
});| Enum value | Numeric value | Meaning |
|---|---|---|
MessageReceiveOption.Receive | 0 | Receive messages normally and allow offline push notifications or other notifications. |
MessageReceiveOption.ReceiveWithoutNotification | 2 | Receive messages without triggering offline push notifications or other notifications. |
Global message reception uses Receive and ReceiveWithoutNotification: Receive disables do not disturb, while ReceiveWithoutNotification enables all-day do not disturb.
The conversation-level recvMsgOpt provides a more granular setting. See Set conversation message reception. When both account-level and conversation-level settings exist, display the final conversation state returned by the server instead of inferring it from local switches alone.
A successful Promise means that the update request has completed, not that OnSelfInfoUpdated has arrived. See Update your profile to learn how to receive the event or query the latest profile again.
Was this page helpful?