Skip to main content

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

CallbackTrigger
onNotifyMultiLoginSyncUser joins or leaves an open channel on another device
onMemberBannedA participant is blocked or unblocked via the Server API
onMemberMutedA participant is muted/unmuted, or the channel is frozen/unfrozen

ParticipantBlockEvent properties

PropertyTypeDescription
chatroomIdString?Open channel ID
operateTypeParticipantOperateType?Block/unblock operation type
durationTimeint?Block duration (ms)
operateTimeint?Operation timestamp (ms)
userIdListList<String>?Affected user IDs
extraString?Additional info

ParticipantBanEvent properties

PropertyTypeDescription
chatroomIdString?Open channel ID
banTypeParticipantBanType?Mute/unmute operation type
durationTimeint?Mute duration (ms), max 43200 minutes
operateTimeint?Operation timestamp (ms)
userIdListList<String>?Affected user IDs
extraString?Additional info