Browse SDKs · WASM
SDKsWASM

Set global message reception

Set the current account’s default message reception and notification behavior for all conversations.

Copy

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 valueNumeric valueMeaning
MessageReceiveOption.Receive0Receive messages normally and allow offline push notifications or other notifications.
MessageReceiveOption.ReceiveWithoutNotification2Receive 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 for the event listener and getSelfUserInfo() reconciliation flow.