PubSubMessageListener

Receives messages on one subscribed topic. Register with PubSub.subscribe.

Every method has a default body, so a listener overrides only the callbacks it cares about.

Functions

Link copied to clipboard
open fun onBatchReceived(messages: List<PubSubMessage>)

Called once per live batch with all of its messages, when the server has batching on for the room. It is a server-side setting, not a subscribe option, so a build must work with and without it.

Link copied to clipboard

Called when the SDK notices the server did not deliver every live message on the topic. PubSubMessageDropInfo.droppedCount is coalesced, so one callback can stand for many messages.

Link copied to clipboard
open fun onMessageReceived(message: PubSubMessage)

Called once for every live message on the topic, in publish order — your own published messages included. That echo is the only confirmation a publish was actually delivered, so drive "sent" state from here rather than from a publish call returning.

Link copied to clipboard

Called once per batch of the topic's stored messages after subscribing.