Skip to main content

Event handlers overview

The Nexconn Chat SDK delivers real-time events through handler interfaces. Each interface covers a specific domain. You register handlers via NCEngine with a unique identifier string, which lets you add multiple independent listeners for the same event type and remove them individually.

How it works

All handler interfaces follow the same pattern:

  1. Register — call the appropriate NCEngine.addXxxHandler(identifier, handler) method before you need events.
  2. Implement — implement only the callbacks you care about. All interface methods have default empty implementations.
  3. Remove — call NCEngine.removeXxxHandler(identifier) when the handler is no longer needed.
kotlin
// Register
NCEngine.addGroupChannelHandler("MY_HANDLER", object : GroupChannelHandler {
override fun onGroupOperation(event: GroupOperationEventInfo) {
println("Group ${event.groupId} operation: ${event.operationType}")
}
})

// Remove
NCEngine.removeGroupChannelHandler("MY_HANDLER")

Most callbacks deliver an event object that carries all the relevant data. Read the details through its properties.

Available handler interfaces

InterfaceRegister/Remove method prefixWhat it covers
GroupChannelHandleraddGroupChannelHandlerGroup operations, profile changes, member changes, join requests, favorites sync
OpenChannelHandleraddOpenChannelHandlerOpen channel enter/exit lifecycle, metadata, members, mute/ban
ChannelHandleraddChannelHandlerChannel list sync, pinned/DND/translate settings, typing status, community sub-channel events
UserHandleraddUserHandlerSubscription events, friend add/delete/apply/clear
UserSettingsHandleraddUserSettingsHandlerUser-level settings sync completed
MessageHandleraddMessageHandlerMessage receive, delete, modify, read receipts, stream messages, metadata
TagHandleraddTagHandlerTag and channel-tag changes (multi-device sync)
TranslateHandleraddTranslateHandlerTranslation language changes and auto-translate state
DatabaseStatusHandleraddDatabaseStatusHandlerDatabase schema upgrade lifecycle
ConnectionStatusHandleraddConnectionStatusHandlerSDK connection status changes