I developed a application using pubnub
. Here I am trying to get list of subscribers of my application connected to the network currently(be in on line). I am using titanium frame work(JavaScript). Can any one tel me how to get this list of subscribers. thanks in advance.
You are asking about how to get a list of active subscribers on a PubNub channel. This is easy to do by using the on "connect" Callback. You will supply an on "connect" function to be called when a new or existing user connects. When this occurs, you will relay this information to where it is needed on your end. I will show you some example code for Titanium:
PUBNUB.subscribe({
channel : "hello_world", // CONNECT TO THIS CHANNEL.
callback : function(message){} // RECEIVED A MESSAGE.
connect : function() { // CONNECTION ESTABLISHED.
// A new user or existing user has
// connected. Send details to your server.
// ---------------------------------------
// This is a psudo-code example function:
// ---------------------------------------
psudo_post_url( "http://www.mywebsite.com/pubnub-user-connected", {
"user_id" : 123456789,
"channel" : "hello_word"
} );
}
})
You can take advantage of this on "connect" callback by sending the information you need to your app servers running in the cloud with Amazon EC2, Rackspace or a dedicated colo host.
Additional resources can be found in these links: