PubSubMessageListener

Listener interface for receiving PubSub messages on a subscribed topic.

Register this listener when subscribing to a topic via subscribe.

Code Example:


PubSubMessageListener listener = new PubSubMessageListener() {
    public void onMessageReceived(PubSubMessage message) {
        Log.d("PubSub", "onMessageReceived: " + message.getMessage());
    }

    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");
    }
};

try {
    meeting.pubSub.subscribe("CHAT", listener);
} catch (Exception e) {
    Log.d("VideoSDK", "subscribe failed: " + e.getMessage());
}

See also

Meeting.PubSub.unsubscribe()

Functions

Link copied to clipboard
Called once per live batch with all messages of that batch, before the per-message onMessageReceived calls for the same batch.
Link copied to clipboard
Called when the SDK detects that the server did not deliver every live message of the topic, reporting how many were lost.
Link copied to clipboard
Called once for every live message published on the subscribed topic.
Link copied to clipboard
Called with one batch of the topic's persisted messages after subscribing.
Called for each batch of the topic's persisted messages after subscribing.