Pub Sub Subscribe Options
Bounds how much history a subscription replays and how fast live messages reach it. Pass one to Room.PubSub.subscribe; passing none replays the whole history at the server's own pace.
These options do not change how messages are delivered. History arrives in server-paced batches on PubSubMessageListener.onOldMessagesReceived either way, and live batching is a server setting rather than a subscribe option.
A room whose server supplies no dedicated pubsub endpoint ignores all of it: the options are still validated, then the whole history arrives as one batch and nothing is paced.
val options = PubSubSubscribeOptions(oldMessageLimit = 100, maxQueue = 70)
room.pubSub.subscribe("CHAT", listener, options)Out-of-range values are not rejected here; subscribe throws ERROR_INVALID_PARAMETER (3073) for them.
Parameters
how many persisted messages to replay on subscribe: null for all of them (the default), 0 for none (live messages only), or N > 0 for the last N. Negative is rejected.
the policy for live messages arriving faster than they drain.
how far a subscriber may fall behind under RealtimeOverflow.QUEUE before the server gives up on it and reports the range through PubSubMessageListener.onMessageDrop. It counts delivery batches, not messages. null (the default) leaves it to the server; N >= 1 asks for N, clamped to the server's maximum, and whichever subscriber subscribes to the topic first fixes it for everyone. Below 1, or combined with RealtimeOverflow.DROP, is rejected.
caps how many live messages this subscriber accepts per 500 ms server window, so roughly 2 × N a second. null (the default) or 0 means unlimited; negative is rejected. Messages past the cap are skipped for this subscriber only and reported through onMessageDrop once delivery continues, so capping a topic you also watch for drops produces drop callbacks by design.