Monitor open channel events
Monitor mute, block, and multi-device join/leave events in open channels by registering an OpenChannelHandler.
Dart
NCEngine.addOpenChannelHandler('events-handler', OpenChannelHandler(
onNotifyMultiLoginSync: (event) {
// Multi-device join/leave sync
print('Multi-device open channel sync: $event');
},
onParticipantBanned: (event) {
// Participant block/unblock events
print('Member blocked: ${event.info?.userIdList}');
},
onParticipantMuted: (event) {
// Participant mute/unmute events
print('Member muted: ${event.info?.userIdList}');
},
));
Remove the handler when it is no longer needed:
Dart
NCEngine.removeOpenChannelHandler('events-handler');
Event callbacks
| Callback | Trigger |
|---|---|
onNotifyMultiLoginSync | User joins or leaves an open channel on another device |
onParticipantBanned | A participant is blocked or unblocked via the Server API |
onParticipantMuted | A participant is muted/unmuted, or the channel is frozen/unfrozen |
OpenChannelParticipantBannedInfo properties
| Property | Type | Description |
|---|---|---|
channelId | String? | Open channel ID |
banType | OpenChannelParticipantBanType? | Block/unblock operation type |
durationTime | int? | Block duration (ms) |
operateTime | int? | Operation timestamp (ms) |
userIdList | List<String>? | Affected user IDs |
extra | String? | Additional info |
OpenChannelParticipantMutedInfo properties
| Property | Type | Description |
|---|---|---|
channelId | String? | Open channel ID |
muteType | OpenChannelParticipantMuteType? | Mute/unmute operation type |
durationTime | int? | Mute duration (ms), max 43200 minutes |
operateTime | int? | Operation timestamp (ms) |
userIdList | List<String>? | Affected user IDs |
extra | String? | Additional info |