MessageBus

class MessageBus(scope: CoroutineScope)

Lightweight pub/sub message bus for intra-component communication.

DO NOT call MessageBus outside of components. MessageBus will become fully internal at some point.

Constructors

Link copied to clipboard
constructor(scope: CoroutineScope)

Functions

Link copied to clipboard
fun <T : Any> publish(topic: Topic<T>, data: T)

Publishes a message to the given topic.

Link copied to clipboard
fun <T : Any> subscribe(topic: Topic<T>): Flow<T>
fun <T : Any> subscribe(topic: Topic<T>, errorHandler: (Throwable) -> Unit = {}, handle: suspend (message: T) -> Unit): MessageHandler<T>