Just a second...

Removing topics

A client can use the TopicControl feature of the Diffusion™ API to add and remove topics at the server.

Required permissions: modify_topic

Currently all topics created using a client have a lifespan the same as the Diffusion server (unless persistence is enabled). The topics remain at the Diffusion server even after the client session that created them has closed unless you explicitly specify that the topic is removed with the session.

A client can remove topics anywhere in the topic tree. The remove operation takes a topic selector, which enables the client to remove many topics at once.

You can also remove all topics beneath a selected topic path by appending the descendant pattern qualifiers, / and //.

Only topics for which the client has modify_topic permission are removed.

If there are topics for which the client does not have modify_topic permission, they are unaffected and the operation completes without throwing an exception.

A client cannot remove topics created by a publisher.

A publisher cannot remove topics created by a client.

For more information, see Topic selectors.

JavaScript
session.topics.removeSelector('topic_selector'))
   .then(function() {
       console.log('Removed all topics that match the selector.');
   });
                    
.NET
ITopicControl topicControl = session.TopicControl;
topicControl.RemoveTopics( topic_selector, callback );
                    
Java and Android
TopicControl topicControl = session.feature(TopicControl.class);
topicControl.remove(topic_selector, callback);
                    
C
// Define callbacks elsewhere
REMOVE_TOPICS_PARAMS_T remove_params = {
        .on_removed = on_topic_removed,
        .on_discard = on_topic_remove_discard,
        .topic_selector = "topic_selector"
};

remove_topics(session, remove_params);
                    
Apple
// Remove topic.
[session.topicControl removeDiscreteWithTopicSelectorExpression: topic_selector
                                                      completionHandler:^(NSError *const error)
{
    if (error) {
        NSLog(@"Failed to remove topic. Error: %@", error);
    } else {
        NSLog(@"Topic removal request succeeded.");
    }
}];