FlowMessageSubscriptionHandler

fun FlowMessageSubscriptionHandler(signaldClient: SignaldClient, coroutineScope: CoroutineScope, context: CoroutineContext = EmptyCoroutineContext, replay: Int = DEFAULT_REPLAY, extraBufferCapacity: Int = DEFAULT_EXTRA_BUFFER_CAPACITY, onBufferOverflow: BufferOverflow = BufferOverflow.SUSPEND)

Parameters

signalWrapper

The Signal 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.

replay

The number of values replayed to new subscribers (cannot be negative, defaults to zero).

extraBufferCapacity

Size of the buffer for emissions to the messages shared flow, allowing slow subscribers to get values from the buffer without suspending emitters. The buffer space determines how much slow subscribers can lag from the fast ones. (optional, cannot be negative, defaults to zero). This option should be used with care; setting a higher buffer means that the client will take messages from signald that will be buffered locally, but if the client crashes and never handles those messages, signald will not resend those messages.

onBufferOverflow

configures an emit action on buffer overflow. Optional, defaults to suspending attempts to emit a value. Values other than BufferOverflow.SUSPEND are supported only when replay > 0 or extraBufferCapacity > 0. Buffer overflow can happen only when there is at least one subscriber that is not ready to accept the new value. In the absence of subscribers only the most recent replay values are stored and the buffer overflow behavior is never triggered and has no effect.