Pusher Private Channel Subscription in android

Viewed 1711

I have issue on private channel subscription in android. These is the my code

        HashMap<String, String> headers = new HashMap<>();
        headers.put("Authorization", code);
        headers.put("Content-Type", "application/x-www-form-urlencoded");
        headers.put("Accept", "application/json");

        final HttpAuthorizer authorizer = new HttpAuthorizer("My URL");

        authorizer.setHeaders(headers);

        PusherOptions options = new PusherOptions()
                .setEncrypted(true)
                .setCluster("ap2")
                .setAuthorizer(authorizer);

        final Pusher pusher = new Pusher("KEY", options);

        pusher.connect(new ConnectionEventListener() {
            @Override
            public void onConnectionStateChange(ConnectionStateChange change) {

            }

            @Override
            public void onError(String message, String code, Exception e) { }
        }, ConnectionState.ALL);

        PrivateChannel channel = pusher.subscribePrivate(channelName);
        channel.bind("message-sent", new PrivateChannelEventListener() {
            @Override
            public void onAuthenticationFailure(String string, Exception ex) {}
            @Override
            public void onSubscriptionSucceeded(String string) {
            }

            @Override
            public void onEvent(String string, String string1, String string2) {}});
pusher.connect();

This create success connection but in subscription it did return any result. Please help me to solve this issue.

1 Answers
Related