PubSub

inner class PubSub

Provides publish-subscribe messaging within the meeting.

Use this to send messages to specific topics and subscribe to receive messages from other participants.

Subscriptions are scoped to one joined session. Leaving the meeting or switching to another room discards every subscription and every registered PubSubMessageListener; nothing is restored automatically, so subscribe again after rejoining. Brief pubsub connection drops within a session are handled internally and do not require this.

Functions

Link copied to clipboard
fun publish(topic: String, message: String, options: PubSubPublishOptions)

fun publish(topic: String, message: String, @NonNull payload: JSONObject, options: PubSubPublishOptions)
Publishes a message to the specified topic.
Link copied to clipboard
fun subscribe(topic: String, listener: PubSubMessageListener)
Subscribes to a topic; the listener receives every message published on it.
Subscribes to a topic, bounding how much history is replayed and how live messages are paced.
Link copied to clipboard
Removes a listener from a topic; the topic itself is unsubscribed once its last listener is removed.