CoreEvent

sealed class CoreEvent

Sealed hierarchy of real-time events emitted by the SDK through CoreClient.events.

Events are delivered via a hot SharedFlow that does not replay past emissions. Collection must begin before events occur in order to observe them. The flow is active only while the CoreClient is started (between CoreClient.start and CoreClient.stop).

The hierarchy is divided into three categories:

  • ConversationEvent — activity within a specific conversation (new entries, typing, queue updates).

  • Connection — real-time connection lifecycle transitions.

  • Error — SDK-level errors encountered during operation.

For conversation-scoped observation, use ConversationClient.events which filters to a single conversation and emits only ConversationEvent instances.

See also

Samples

scope.launch {
    coreClient.events.collect { event ->
        when (event) {
            is CoreEvent.ConversationEvent.Entry -> {
                val entry = event.conversationEntry
            }
            is CoreEvent.ConversationEvent.ProgressIndicator -> {
                // Agent is typing
            }
            is CoreEvent.Connection -> {
                // Connection state changed (Connecting, Open, Closed, Ping)
            }
            is CoreEvent.Error -> {
                // Handle error: event.message, event.exception
            }
            else -> {}
        }
    }
}

Inheritors

Constructors

Link copied to clipboard
protected constructor()

Types

Link copied to clipboard
data class Connection(val event: ServerSentEvent.Connection) : CoreEvent

Emitted when the real-time server connection transitions between lifecycle states.

Link copied to clipboard
sealed class ConversationEvent(val conversationId: UUID) : CoreEvent

Events scoped to a specific conversation, identified by conversationId.

Link copied to clipboard
data class Error(val message: String, val exception: Exception = Exception(UNKNOWN_EXCEPTION)) : CoreEvent

Emitted when the SDK encounters an error during operation.