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

JS API - Disconnecting

When the internet is disconnected, is it recommended to stop the mobile Pubsub from sending 'ping' requests to the server?

How do we do this with the JS SDK?

Hey Dewi,

Who recommends this? If you'd like to unsubscribe using the javsacript SDK, you can use pubnub.unsubscribe().

The internet is disconnected, so unsubscribe would not work properly?

There should be no need to do anything at all. The SDK should get a disconnect callback and should not be sending any further pings until a reconnect callback is invoked and the SDK and your client are back online.

Perhaps you can provide further details about the issue you are having?

Hi Craig, I tested the JS library by initializing, subscribing, and then disconnecting the internet. When I disconnect the pubnub requests continues with a failed status until I reconnect the internet. It doesn't stop trying.

Example URL requested: https://ps9e7c0076.pubnub.com/time/0?uuid=f56cb3b3-8e5f-4b5f-b66b-6399e901ec38&pnsdk=PubNub-JS-Web%2F3.7.10


Comments to this discussion are now closed!