CoroutineMessageSubscriptionHandler

abstract class CoroutineMessageSubscriptionHandler(signaldClient: SignaldClient, coroutineScope: CoroutineScope, context: CoroutineContext) : AutoCloseable

An abstract incoming message subscription handler that uses a coroutine to handle the event loop for messages.

The coroutine is the emissionJob, which is started lazily. Derived classes must start the emissionJob explicitly by calling emissionJob.start() in an init block to ensure that asynchronous work is only ready when the derived class is ready. This is because of derived class initialization order. Read more at https://www.ibm.com/developerworks/java/library/j-jtp0618/index.html.

Parameters

signaldClient

The SignaldClient instance. Must be associated with an account registered with signald.

coroutineScope

The CoroutineScope to use for the message subscription coroutine. This is used to cancel the handler.

context

Additional coroutine context to the coroutineScope's context.

Constructors

Link copied to clipboard
fun CoroutineMessageSubscriptionHandler(signaldClient: SignaldClient, coroutineScope: CoroutineScope, context: CoroutineContext = EmptyCoroutineContext)

Functions

Link copied to clipboard
open override fun close()

Inheritors

Link copied to clipboard
Link copied to clipboard