Just a second...

Receiving topic notifications

Receive topic notifications using topic selectors. This enables a client to receive updates when topics are added or removed, without the topic values.

Note: Topic notifications are supported by the Android™ API, Java™ API and JavaScript® API.

The client must register a listener object to receive notifications about selected topics. Use a topic selector to specify the topics.

For more details about topic notifications, see Topic notifications.

Required permissions: select_topic and read_topic permissions for the specified topics

Receiving topic notifications

A client can register to receive notifications about a set of topics via a listener object.

var listener = {
    onDescendantNotification: function(topicPath, type) {},
    onTopicNotification: function(topicPath, topicSpecification, type) {},
    onClose: function() {},
    onError: function(error) {}

session.notifications.addListener(listener).then(function(reg) {
Java and Android
final TopicNotifications notifications = session.feature(TopicNotifications.class);

final TopicNotificationListener listener = new TopicNotificationListener() {
    public void onTopicNotification(String topicPath, TopicSpecification specification, NotificationType type) {
        // Handle notifications for selected/deselected topics

    public void onDescendantNotification(String topicPath, NotificationType type) {
        // Handle notifications for immediate descendants

    public void onClose() {
        // The listener has been closed

    public void onError(ErrorReason error) {
        // The listener has encountered an error

final CompletableFuture<NotificationRegistration> future = notifications.addListener(listener);
final NotificationRegistration registration = future.get();