ChannelMessageSubscriptionHandler

fun ChannelMessageSubscriptionHandler(signaldClient: SignaldClient, coroutineScope: CoroutineScope, context: CoroutineContext = EmptyCoroutineContext, bufferCapacity: Int = Channel.RENDEZVOUS, onBufferOverflow: BufferOverflow = BufferOverflow.SUSPEND, onUndeliveredElement: (ClientMessageWrapper) -> Unit? = null)

Parameters

signaldClient

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

coroutineScope

The CoroutineScope to use for the message subscription coroutine.

context

An additional CoroutineContext that will be added to the given coroutineScope's context.

bufferCapacity

Size of the buffer for the channel. (optional, cannot be negative, defaults to Channel.RENDEZVOUS, i.e. 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 action on buffer overflow (optional, defaults to a suspending attempt to send a value, supported only when capacity >= 0 or capacity == Channel.BUFFERED, implicitly creates a channel with at least one buffered element)

onUndeliveredElement

An optional function that is called when element was sent but was not delivered to the consumer. See "Undelivered elements" section in Channel documentation.