Just a second...

Example: Receive notifications when a client subscribes to a routing topic

The following examples use the SubscriptionControl feature in the Diffusion™ API to listen for notifications of when a client subscribes to a routing topic.

Java and Android
package com.pushtechnology.diffusion.examples;

import com.pushtechnology.diffusion.client.Diffusion;
import com.pushtechnology.diffusion.client.features.control.topics.SubscriptionControl;
import com.pushtechnology.diffusion.client.features.control.topics.SubscriptionControl.RoutingSubscriptionRequest;
import com.pushtechnology.diffusion.client.features.control.topics.SubscriptionControl.SubscriptionCallback;
import com.pushtechnology.diffusion.client.session.Session;

 * This demonstrates using a control client to be notified of subscription
 * requests to routing topics.
 * <P>
 * This uses the 'SubscriptionControl' feature.
 * @author Push Technology Limited
 * @since 5.0
public class ControlClientSubscriptionControlRouting {

    private final Session session;

     * Constructor.
     * @param routingCallback for routing subscription requests
    public ControlClientSubscriptionControlRouting(
        final SubscriptionCallback routingCallback) {

        session =

        final SubscriptionControl subscriptionControl =

        // Sets up a handler so that all subscriptions to topic a/b are routed
        // to routing/target/topic
        // To do this, the client session requires the 'view_session',
        // 'modify_session', and 'register_handler' permissions.
            new SubscriptionControl.RoutingSubscriptionRequest.Handler
            .Default() {
                public void onSubscriptionRequest(
                    final RoutingSubscriptionRequest request) {



     * Close the session.
    public void close() {

Change the URL from that provided in the example to the URL of the Diffusion server.