0

I'm trying to detect network loss or non-graceful disconnects of a participant and then fire the timeout event after 30s from disconnectivity. I tried the following in viewDidLoad using two devices:

PNConfiguration *config = [PNConfiguration configurationForOrigin:@"pubsub.pubnub.com" publishKey:@"myKey" subscribeKey:@"myKey" secretKey:@"myKey"];
[PubNub setClientIdentifier:_user[@"username"]];
config.presenceHeartbeatInterval = 30;
[PubNub setConfiguration:config];
[PubNub connect];

I set one of the devices to flight mode. the timeout is fired after ~ 320s which is the default value. It seems presenceHeartbeatInterval value did not do anything. I tried to set

config.presenceHeartbeatInterval = 6;
config.presenceHeartbeatTimeout = 30;

and once I subscribed to a channel, the timeout event is fired every 30s even when the device is connected to the internet.

Does anyone know how to set the timeout value so that the timeout event is fired after the specified value when the network is lost / non-graceful disconnects ?

mbrmj
  • 119
  • 10
  • strange, it should work... please shoot us an email at support@pubnub.com and we'll be happy to help you troubleshoot further, please include the iOS log and the iOS client version you are on. – Geremy Mar 11 '15 at 00:49

1 Answers1

1

Try use latest client version (3.7.9.3). Presence heartbeat timer will fire only if client subscribed on some channels. With your configuration server will be pinged with 6 second interval to tell him maximum time of heartbeat inactivity after which server will kick subscriber from channels.

Serhii Mamontov
  • 4,942
  • 22
  • 26