Global do not disturb
Set a global do-not-disturb (DND) time window for the current user. During the DND period, push notifications are suppressed according to the configured DND level.
- The DND window starts at a specified time (
HH:MM:SS) and lasts for a configurable number of minutes. The window repeats daily until changed or removed. - Each user can have one DND time window at a time. Setting a new window replaces the previous one.
tip
- During the DND window, if the client is offline, the server does not send push notifications.
- Global DND is a user-level setting with the highest priority. It overrides all other DND configurations.
- Web does not receive push notifications directly. This setting affects push behavior on mobile devices.
Set the DND time window and level
DND levels
| Level | Value | Description |
|---|---|---|
NoDisturbTimeLevel.DEFAULT | 0 | Not set. The server checks other DND settings (channel-level, app-level) to determine if a notification should be sent. |
NoDisturbTimeLevel.MENTION | 1 | Only @mention messages trigger notifications (both @specific user and @all). |
NoDisturbTimeLevel.MUTED | 5 | No notifications, even for @mention messages. |
Set DND
TypeScript
import { NCEngine, NoDisturbTimeLevel } from '@nexconn/chat';
NCEngine.setNoDisturbTime({
startTime: '21:00:00', // Start time in HH:mm:ss format
spanMinutes: 1400, // Duration in minutes
level: NoDisturbTimeLevel.DEFAULT,
// timezone: 'Asia/Shanghai' // Optional timezone
}).then((res) => {
console.log('DND set. Code:', res.code);
});
For permanent 24-hour DND, set startTime to 00:00:00 and spanMinutes to 1439.