PubSubPublishOptions

class PubSubPublishOptions(val persist: Boolean = false, val sendOnly: Array<String>? = null)

Decides who receives a message and whether late joiners still see it. Pass one to Room.PubSub.publish; passing none broadcasts the message to every subscriber and keeps nothing.

val options = PubSubPublishOptions(persist = true, sendOnly = arrayOf(hostId))
room.pubSub.publish("CHAT", "hello", options)

Parameters

persist

true stores the message on the server, so anyone who subscribes to the topic later receives it on PubSubMessageListener.onOldMessagesReceived. false, the default, delivers it once to whoever is subscribed right now.

sendOnly

delivers the message only to these participant ids. null, the default, and an empty array both broadcast to every subscriber.

Constructors

Link copied to clipboard
constructor(persist: Boolean = false, sendOnly: Array<String>? = null)

Properties

Link copied to clipboard
val persist: Boolean = false
Link copied to clipboard
val sendOnly: Array<String>? = null