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 ?