Search code examples
javascriptpubnub

PUBNUB here_now returning wrong channel list


I have subscribed with new channel as well as new publish_key and sub_key where I want to see complete channel list with these keys,So I am using

PUBNUB.here_now({
uuids:true,
callback:function(w){
console.log(w);
}
});

And it is returning 1300 channels with thousands of occupacy where it should return channels list with two channels because I am subscribed with only two channels.

you can check this with developer console also.

Please provide me solution why it is happening so?


Solution

  • finally,I got the solution while scretching head all the day ,When i explored library I came to know that If we are providing values to PUBNUB.init() and we are storing its intstance it will take 'demo' as there keys

    For example :

     PUBNUB.init({
        publish_key://my publish key,
        subscribe_key://my subscrition key
     });
    

    then

    PUBNUB.here_now({
       uuids:true,
       callback:function(e){
       console.log(e);
      }
    });
    

    It will return values according to 'demo' keys because you PUBNUB.init() returns instance which is pointing to some SELF function of library so if you are not calling methods with returning instance it will return values according to 'demo' keys otherwise not. Have a look

    var pubnub=PUBNUB.init({
        publish_key://my publish key,
        subscribe_key://my subscrition key
      }); 
    

    then

    pubnub.here_now({
        uuids:true,
        callback:function(e){
        console.log(e);
       }
     });
    

    Where according to it should return error if you are not using PUBNUB instance because it may confuse developer why he is not getting right values unless he will not explore library code.