PubSubMessage

Represents a message received or published via the PubSub system.

A PubSubMessage contains the message text, sender information, topic, timestamp, and an optional payload.

Code Example:


try {
    meeting.pubSub.subscribe("CHAT", new PubSubMessageListener() {
        public void onMessageReceived(PubSubMessage message) {
            String text = message.getMessage();
            String sender = message.getSenderName();
            long timestamp = message.getTimestamp();
            Log.d("PubSub", sender + ": " + text);
        }

        public void onOldMessagesReceived(List<PubSubMessage> messages) {
            Log.d("PubSub", "onOldMessagesReceived: " + messages);
        }

        public void onOldMessagesReceived(List<PubSubMessage> messages, PubSubHistoryInfo info) {
            Log.d("PubSub", "onOldMessagesReceived: " + messages.size() + " messages, isLast: " + info.isLast());
        }

        public void onBatchReceived(List<PubSubMessage> messages) {
            Log.d("PubSub", "onBatchReceived: " + messages.size() + " messages");
        }

        public void onMessageDrop(PubSubMessageDropInfo info) {
            Log.d("PubSub", "onMessageDrop: dropped " + info.getDroppedCount() + " messages");
        }
    });
} catch (Exception e) {
    Log.d("VideoSDK", "subscribe failed: " + e.getMessage());
}

See also

PubSubMessageListener.onMessageReceived()

Meeting.PubSub.publish()

Properties

Link copied to clipboard
var id: String
The unique identifier of this message.
Link copied to clipboard
The message text content.
Link copied to clipboard
An optional JSON payload associated with this message.
Link copied to clipboard
The ID of the participant who sent this message.
Link copied to clipboard
The display name of the participant who sent this message.
Link copied to clipboard
The timestamp of when this message was published, in milliseconds since epoch (UTC).
Link copied to clipboard
The topic this message was published to.