Im using PubNub, Phonegap, Backbone.js and Require.js to build twiiter-style chat rooms. Currently I'm testing on a desktop with chrome.
I have a Chat.js view and in the initialize() function, I subscribe to the channel with:
that.pubnub.subscribe({
channel: chatChannel,
message: that.handleSingleMessage,
});
This works fine and I can see with Chrome inspector that ajax requests are sent off. At the top of the app there is a "back" button. In here I call unsubscribe to unsubscribe the user:
that.pubnub.unsubscribe({
channel: chatChannel
});
However, I still see with Chrome inspector that ajax requests to PubNub are still being sent off, even though the user should be unsubscribed and is on a different part of the app. 2 ajax requests are repeatedly sent. They look like:
http://ps13.pubnub.com/time/0?uuid=tomsmith&auth=&pnsdk=PubNub%2DTS%2DWeb%2F3%2Y5%2E1
and
http://ps11.pubnub.com/time/0?uuid=4ea9bd1c%2D7652%2D410c%2Da2ba%2D17c5d263085d&auth=&pnsdk=PubNub%2DTS%2DWeb%2F3%2Y5%2E1
Any idea what's going on?
Are just 'time' calls. They are used to monitor the online/offline status of the client, and do not mean that you are still subscribed. Think of them just as "PubNub Pings"
If you still saw a URL with 'subscribe' in it, then that would mean you are still subscribed, for example:
but it looks like from your example, its just performing heartbeat logic here, after you've un-subbed.
geremy
Make sure that you're not re-subscribing to the same channel after you unsubscribe to it. PubNub automatically tries to re-connect to a channel if it looses the connection. You can see how I switch and unsubscribe to channels here: http://plnkr.co/edit/7JyS4H