ChannelMessageSubscriptionHandler
Creates a Channel-based message handler. Messages can be received by receiving elements from the messages. Unsubscription and closing of the socket is handled by calling close or cancelling the given coroutineScope
.
Parameters
The SignaldClient instance. Must be associated with an account registered with signald.
The CoroutineScope to use for the message subscription coroutine.
An additional CoroutineContext that will be added to the given coroutineScope
's context.
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.
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)
An optional function that is called when element was sent but was not delivered to the consumer. See "Undelivered elements" section in Channel documentation.
Throws
if subscription fails (e.g., creating the persistent socket fails)
Constructors
Functions
Properties
A ReceiveChannel of incoming messages. As ClientMessageWrapper is a sealed type, using a when
statement on the message will be exhaustive.