unsubscribe
Removes a listener from a topic; the topic itself is unsubscribed once its last listener is removed.
Removing the last listener of a topic requires a joined meeting: before the meeting reaches CONNECTED it throws and onError fires with code 3001 (ERROR_ACTION_PERFORMED_BEFORE_MEETING_JOINED); while the meeting is RECONNECTING it throws without an error event. Removing any other listener is local and never throws.
If the server rejects the unsubscribe, onError fires with code 4089 (PUBSUB_UNSUBSCRIBE_FAILED) carrying the server's reason.
Code Example:
try {
meeting.pubSub.unsubscribe("CHAT", pubSubMessageListener);
} catch (Exception e) {
Log.d("VideoSDK", "unsubscribe skipped: " + e.getMessage());
}
Parameters
the topic name to unsubscribe from
the PubSubMessageListener to remove
Throws
if the meeting is not joined or is reconnecting, or the pubsub connection is temporarily down, while removing the last listener of the topic; the listener stays registered — retry once the meeting is CONNECTED