The community forums are in BETA and closed to the public.

What is channel in subscribe and publish

Hello sir, I have following information regarding to pubnub key details...

//I want to subscribe and publish to message then give me error Like: Authentication Failure. Incorrect Authentication Key

//subscribe code

           String publish_key = "pub-c-01fb7ff2-f862-4e53-a7fd-8fa05665df02";
           String subscribe_key = "sub-c-d1f3a470-f576-11e4-8fd2-02ee2ddab7fe";
           String secret_key = "sec-c-YmE4MzZkZTAtMGQ2Ni00ZGFlLTk4ZGEtMTEyNzU2MGMwMzBj";

          pubnub = new Pubnub(publish_key, .subscribe_key, secret_key,ssl_on);

       try {
                  pubnub.subscribe("MyChat", subscribeCallback);
   } catch (PubnubException e) {

        Callback subscribeCallback = new Callback() {
    public void connectCallback(String channel, Object message) {
        Log.e("Connect Callback channel", ""+channel);
        Log.e("Connect Callback  message", ""+message);
    public void disconnectCallback(String channel, Object message) {
        Log.e("disconnect Callback channel", ""+channel);
        Log.e("disconnect Callback  message", ""+message);
    public void reconnectCallback(String channel, Object message) {
        Log.e("reconnect Callback channel", ""+channel);
        Log.e("reconnect Callback  message", ""+message);
    public void successCallback(String channel, Object message, String timetoken) {
        Log.e("success Callback channel", ""+channel);
        Log.e("success Callback  message", ""+message);

    public void errorCallback(String channel, com.pubnub.api.PubnubError error) {
        Log.e("error Callback channel", ""+channel);
        Log.e("error Callback  error", ""+error);

//It is same as Publish

1 person has this question

Login or Signup to post a comment