PNStatus Class Reference
Inherits from | PNResult : NSObject |
---|---|
Declared in | PNStatus.h |
Overview
In case of error this instance may contain service response in \c data. Also this object hold additional information about current client state.
@author Sergey Mamontov
Information
category
One of \b PNStatusCategory fields which provide information about for which status this instance has been created.
@property (nonatomic, readonly, assign) PNStatusCategory category
Return Value
Processing status category.
Availability
4.0
Declared In
PNStatus.h
error
Whether status object represent error or not.
@property (nonatomic, readonly, assign, getter=isError) BOOL error
Return Value
\c YES in case if status represent request processing error.
Availability
4.0
Declared In
PNStatus.h
automaticallyRetry
Autoretry configuration information.
@property (nonatomic, readonly, assign, getter=willAutomaticallyRetry) BOOL automaticallyRetry
Return Value
\c YES in case if request which represented with this failed status will be resent automatically or not.
Availability
4.0
Discussion
In most cases client will keep retry request sending till it won’t be successful or canceled with \c cancelAutomaticRetry method.
Declared In
PNStatus.h
Recovery
– retry
Try to resend request associated with processing status object.
- (void)retry
Availability
4.0
Discussion
Some operations which perform automatic retry attempts will ignore method call.
Declared In
PNStatus.h
– cancelAutomaticRetry
For some requests client try to resend them to \b PubNub for processing.
- (void)cancelAutomaticRetry
Availability
4.0
Discussion
This method can be performed only on operations which respond with \c YES on \c willAutomaticallyRetry property. Other operation types will ignore method call.
Declared In
PNStatus.h
Extension Methods
currentTimetoken
Stores reference on time token which has been used to establish current subscription cycle.
@property (nonatomic, strong) NSNumber *currentTimetoken
Availability
4.0
Declared In
PNStatus+Private.h
lastTimeToken
Stores reference on previous key which has been used in subscription cycle to receive \c currentTimetoken along with other events.
@property (nonatomic, strong) NSNumber *lastTimeToken
Availability
4.0
Declared In
PNStatus+Private.h
subscribedChannels
Stores reference on list of channels on which client currently subscribed.
@property (nonatomic, copy) NSArray *subscribedChannels
Availability
4.0
Declared In
PNStatus+Private.h
subscribedChannelGroups
Stores reference on channel group names list on which client currently subscribed.
@property (nonatomic, copy) NSArray *subscribedChannelGroups
Availability
4.0
Declared In
PNStatus+Private.h
retryBlock
Stores reference on block which can be used to retry request processing.
@property (nonatomic, copy) dispatch_block_t retryBlock
Availability
4.0
Discussion
This blocks provided only for requests which won’t be auto-restarted by client.
Declared In
PNStatus+Private.h
retryCancelBlock
Stores reference on block which can be used to cancel automatic retry on requests.
@property (nonatomic, copy) dispatch_block_t retryCancelBlock
Availability
4.0
Discussion
Usually requests resent by client \b 1 second late after failure and this is time when request can be canceled by user using \c cancelAutomaticRetry method.
Declared In
PNStatus+Private.h
+ statusForOperation:category:
Construct minimal object to describe state using operation type and status category information.
+ (instancetype)statusForOperation:(PNOperationType)operation category:(PNStatusCategory)category
Parameters
operation |
Type of operation for which this status report. |
---|---|
category |
Operation processing status category. |
Return Value
Constructed and ready to use status object.
Availability
4.0
Declared In
PNStatus+Private.h
– initForOperation:category:
Initializr minimal object to describe state using operation type and status category information.
- (instancetype)initForOperation:(PNOperationType)operation category:(PNStatusCategory)category
Parameters
operation |
Type of operation for which this status report. |
---|---|
category |
Operation processing status category. |
Return Value
Initialized and ready to use status object.
Availability
4.0
Declared In
PNStatus.m
– initForOperation:completedWithTaks:processedData:
Initialize result instance in response to successful task completion.
- (instancetype)initForOperation:(PNOperationType)operation completedWithTaks:(NSURLSessionDataTask *)task processedData:(NSDictionary *)processedData
Parameters
operation |
One of \b PNOperationType enum fields to describe what kind of operation has been processed. |
---|---|
task |
Reference on data task which has been used to communicate with \b PubNub network. |
processedData |
Reference on data which has been loaded and pre-processed by corresponding parser. |
Return Value
Initialized and ready to use result instance.
Availability
4.0
Declared In
PNStatus.m
– categoryTypeFromStatusCode:
Try interpret response status code meaningful status object state.
- (PNStatusCategory)categoryTypeFromStatusCode:(NSInteger)statusCode
Parameters
statusCode |
HTTP response status code which should be used during interpretation. |
---|
Availability
4.0
Declared In
PNStatus.m
– dictionaryRepresentation
Convert result object to dictionary which can be used to print out structured data
- (NSDictionary *)dictionaryRepresentation
Return Value
Object in dictionary representation.
Availability
4.0
Declared In
PNResult+Private.h