MessageHandler

public interface MessageHandler

Message event handler.

Listens for all message-related event notifications, including:

  • Receive: real-time and offline message reception, offline sync completion

  • Lifecycle: message deletion (recall), modification, and blocking (sensitive word filtering)

  • Read receipts: read receipt responses from other users

  • Metadata: message metadata (expansion) updates and deletions

  • Speech-to-text: voice message transcription completion

  • Stream messages: stream request init, incremental chunks, and completion

  • Community: community channel message metadata changes

Register via NCEngine.addMessageHandler. All callback methods have default empty implementations; override only the callbacks you need.

NCEngine.addMessageHandler("MSG_HANDLER_ID", object : MessageHandler {
override fun onMessageReceived(event: MessageReceivedEvent) {
println("Received: ${event.message.messageId}")
}

override fun onMessageReceiptResponse(event: MessageReceiptResponseEvent) {
event.responses.forEach { response ->
println("Message ${response.messageId} read count: ${response.readCount}")
}
}

override fun onMessageBlocked(event: MessageBlockedEvent) {
println("Message blocked: ${event.info.messageId}, reason: ${event.info.blockType}")
}
})

Functions

Link copied to clipboard

Called when community channel message metadata (expansion) is changed.

Link copied to clipboard

Called when a sent message is blocked due to sensitive words.

Link copied to clipboard

Called when a message is deleted (recalled).

Link copied to clipboard

Called when message metadata (expansion) keys are deleted.

Link copied to clipboard

Called when message metadata (expansion) is updated.

Link copied to clipboard

Called when read receipts are received.

Link copied to clipboard

Called when a message is received.

Link copied to clipboard

Called when a message is modified.

Link copied to clipboard

Called when offline modified message records have been fully synced.

Link copied to clipboard

Called when offline message sync completes.

Link copied to clipboard

Called when speech-to-text conversion completes.

Link copied to clipboard

Called when a stream message request completes.

Link copied to clipboard

Called when an incremental stream chunk is received.

Link copied to clipboard

Called when a stream message request is initialized.