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');
},
onMemberBanned: (event) {
// Participant block/unblock events
print('Member blocked: $event');
},
onMemberMuted: (event) {
// Participant mute/unmute events
print('Member muted: $event');
},
));
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 |
onMemberBanned | A participant is blocked or unblocked via the Server API |
onMemberMuted | A participant is muted/unmuted, or the channel is frozen/unfrozen |
ParticipantBlockEvent properties
| Property | Type | Description |
|---|---|---|
chatroomId | String? | Open channel ID |
operateType | ParticipantOperateType? | Block/unblock operation type |
durationTime | int? | Block duration (ms) |
operateTime | int? | Operation timestamp (ms) |
userIdList | List<String>? | Affected user IDs |
extra | String? | Additional info |
ParticipantBanEvent properties
| Property | Type | Description |
|---|---|---|
chatroomId | String? | Open channel ID |
banType | ParticipantBanType? | 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 |