PNConfiguration Class Reference

Inherits from NSObject
Declared in PNConfiguration.h

Overview

Uset this instance to provide values which should be by client to communicate with \b PubNub netwrok.

@author Sergey Mamontov

Initialization and Configuration

  origin

Reference on host name or IP address which should be used by client to get access to \b PubNub services.

@default Client will use it’s own constant (\b pubsub.pubnub.com) value if origin not specified.

@property (nonatomic, copy) NSString *origin

Availability

4.0

Declared In

PNConfiguration.h

  publishKey

Reference on key which is used to push data/state to \b PubNub service.

@property (nonatomic, copy) NSString *publishKey

Availability

4.0

Discussion

Note: This key can be obtained on PubNub’s administration portal after free registration https://admin.pubnub.com

Warning: Can’t be \c nil and in attempt to set \c nil will throw \b UnacceptableValue exception.

Declared In

PNConfiguration.h

  subscribeKey

Reference on key which is used to fetch data/state from \b PubNub service.

@property (nonatomic, copy) NSString *subscribeKey

Availability

4.0

Discussion

Note: This key can be obtained on PubNub’s administration portal after free registration https://admin.pubnub.com

Warning: Can’t be \c nil and in attempt to set \c nil will throw \b UnacceptableValue exception.

@default Client will use it’s own constant (\b demo) value if origin not specified.

Declared In

PNConfiguration.h

  authKey

Reference on key which is used along with every request to \b PubNub service to identify client user.

@property (nonatomic, copy) NSString *authKey

Availability

4.0

Discussion

\b PubNub service provide \b PAM (PubNub Access Manager) functionality which allow to specify access rights to access \b PubNub services with provided \c publishKey and \c subscribeKey keys. Access can be limited to concrete users. \b PAM system use this key to check whether client user has rights to access to required service or not.

@default By default this value set to \b nil.

Declared In

PNConfiguration.h

  uuid

Reference on unique client identifier used to identify concrete client user from another which currently use \b PubNub services.

@property (nonatomic, copy, setter=setUUID:) NSString *uuid

Availability

4.0

Discussion

This value is different from \c authKey (which is used only by \b PAM) and represent concrete client across server. This identifier is used for presence events to tell what some client joined or leaved live feed.

Warning: There can’t be two same client identifiers online at the same time.

@default Client will use it’s own-generated value if won’t be specified by user.

Declared In

PNConfiguration.h

  cipherKey

Reference on encryption key.

@property (nonatomic, copy) NSString *cipherKey

Availability

4.0

Discussion

Key which is used to encrypt messages pushed to \b PubNub service and decrypt messages received from live feeds on which client subscribed at this moment.

Declared In

PNConfiguration.h

  subscribeMaximumIdleTime

Stores reference on maximum number of seconds which client should wait for events from live feed.

@property (nonatomic, assign) NSTimeInterval subscribeMaximumIdleTime

Availability

4.0

Discussion

By default value is set to \b 310 seconds. If in specified time frame \b PubNub service won’t push any events into live feed client will re-subscribe on remote data objects with same time token (if configured).

Declared In

PNConfiguration.h

  nonSubscribeRequestTimeout

Reference on number of seconds which is used by client during non-subscription operations to check whether response potentially failed with ‘timeout’ or not.

@property (nonatomic, assign) NSTimeInterval nonSubscribeRequestTimeout

Availability

4.0

Discussion

This is maximum time which client should wait fore response from \b PubNub service before reporting reuest error.

@default Client will use it’s own constant (\b 10 seconds) value if origin not specified.

Declared In

PNConfiguration.h

  presenceHeartbeatValue

Reference on number of seconds which is used by server to track whether client still subscribed on remote data objects live feed or not.

@property (nonatomic, assign) NSInteger presenceHeartbeatValue

Availability

4.0

Discussion

This is time within which \b PubNub service expect to receive heartbeat request from this client. If heartbeat request won’t be called in time \b PubNub service will send to other subscribers \c ‘timeout’ presence event for this client.

Note: This value can’t be smaller then \b 5 seconds and larget then \b 300 seconds and will be reset to it automatically.

@default By default heartbeat functionality disabled.

Declared In

PNConfiguration.h

  presenceHeartbeatInterval

Reference on number of seconds which is used by client to issue heartbeat requests to \b PubNub service.

@property (nonatomic, assign) NSInteger presenceHeartbeatInterval

Availability

4.0

Discussion

Note: This vlaue should be smaller then \c presenceHeartbeatTimeout for better presence control.

@default By default heartbeat functionality disabled.

Declared In

PNConfiguration.h

  TLSEnabled

Stores whether client should communicate with \b PubNub services using secured connection or not.

@default By default client use \b YES to secure communication with \b PubNub services.

@property (nonatomic, assign, getter=isTLSEnabled) BOOL TLSEnabled

Availability

4.0

Declared In

PNConfiguration.h

  keepTimeTokenOnListChange

Stores whether client should keep previous time token when subscribe on new set of remote data objects live feeds.

@default By default client use \b YES to and previous time token will be used during subscription on new data objects.

@property (nonatomic, assign, getter=shouldKeepTimeTokenOnListChange) BOOL keepTimeTokenOnListChange

Availability

4.0

Declared In

PNConfiguration.h

  restoreSubscription

Stores whether client should restore subscription on remote data objects live feed after network connection restoring or not.

@property (nonatomic, assign, getter=shouldRestoreSubscription) BOOL restoreSubscription

Availability

4.0

Discussion

If set to \c YES as soon as network connection will be restored client will restore subscription to previously subscribed remote data objects live feeds.

@default By default client use \b YES to restore subscription on remote data objects live feeds.

Declared In

PNConfiguration.h

  catchUpOnSubscriptionRestore

Stores whether client should try to catch up for events which occurred on previously subscribed remote data objects feed while client was off-line.

@property (nonatomic, assign, getter=shouldTryCatchUpOnSubscriptionRestore) BOOL catchUpOnSubscriptionRestore

Availability

4.0

Discussion

Live feeds return in response with events so called ‘time token’ which allow client to specify target time from which it should expect new events. If property is set to \c YES then client will re-use previously received ‘time token’ and try to receive messages from the past.

Warning: If there history/storage feature has been activated for \b PubNub account, some messages can be pushed to it after some period of time and catch up won’t be able to receive them.

Declared In

PNConfiguration.h

+ configurationWithPublishKey:subscribeKey:

Construct configuration instance using minimal required data.

+ (instancetype)configurationWithPublishKey:(NSString *)publishKey subscribeKey:(NSString *)subscribeKey

Parameters

publishKey

Key which allow client to use data push API.

subscribeKey

Key which allow client to subscribe on live feeds pushed from \b PubNub service.

Return Value

Configured and ready to se configuration instance.

Availability

4.0

Declared In

PNConfiguration.h

Extension Methods

  deviceID

Stores reference on unique device identifier based on bundle identifier used by software vendor.

@property (nonatomic, copy) NSString *deviceID

Availability

4.0

Declared In

PNConfiguration+Private.h

– initWithPublishKey:subscribeKey:

Initialize configuration instance using minimal required data.

- (instancetype)initWithPublishKey:(NSString *)publishKey subscribeKey:(NSString *)subscribeKey

Parameters

publishKey

Key which allow client to use data push API.

subscribeKey

Key which allow client to subscribe on live feeds pushed from \b PubNub service.

Return Value

Configured and ready to se configuration instance.

Availability

4.0

Declared In

PNConfiguration.m