ROSuperHTTPClientChannel

Overview

This class is the Xcode implementation of the Super HTTP Channel - the enhanced HTTP-based channel which provides a sophisticated and flexible communication channel which uses persistent connections to enable true asynchronous calls and server callbacks.
Notice for iOS4 users: when the application is being sent to background the channel will try to close the communication gracefully after all pending requests completed. Then it will reestablish connection from the scratch when sent to foreground again. So it is impossible to send any server events to the client while it is in background mode. Please consider using push notifications instead (article: Adding Push Notifications to Your iPhone Applications Using Remoting SDK|iOS}}).

Location


 

active  assign

Assigning a value to this property allows to activate and deactivate the server. The channel performs the handshaking procedure with the server when activated and will throw an exception if no answer was received from the server during connectTimeout interval (or the answer was invalid). It is recommended to set this property to NO when finishing the user application to shutdown the connection gracefully.
Both activating and deactivating operations are synchronous i.e. the control will not return to the calling code until all required operations are completed or an execption is raised.

@property (assign) BOOL active

activeClientChannelDelegate  assign

This property is used to connect the client channel and the ROEventReceiver instance to process incoming callback events. As a rule this property should not be assigned from the user code.

@property (assign) id<ROActiveClientChannelDelegate> activeClientChannelDelegate

asyncDispatch:  protected deprecated    (declared in ROClientChannel)

For internal use

Dispatches the given message asynchronously and returns an ROAsyncRequest reference.

This method relies on the internal method intAsyncDispatch:responseMessage: which implemenation depends on concrete client channel.

This method is deprecated. If you will need to dispatch some mesages manually, then please use asyncDispatch:withProxy:start or asyncDispatch:withProxy:startWithBlock: instead

- (ROAsyncRequest *) asyncDispatch:(id)aMessage

Parameters:

  • aMessage: instance of ROMessage that need to be dispatched

asyncDispatch:start:  protected deprecated    (declared in ROClientChannel)

For internal use

Prepares and return asynchronous request for dispatching the given message.

This method relies on the internal method intAsyncDispatch:responseMessage: which implemenation depends on concrete client channel.

This method is deprecated. If you will need to dispatch some mesages manually, then please use asyncDispatch:withProxy:start or asyncDispatch:withProxy:startWithBlock: instead

- (ROAsyncRequest *) asyncDispatch:(id)aMessage start:(BOOL)start

Parameters:

  • aMessage: instance of ROMessage that need to be dispatched
  • start: Boolean flag, If YES then it start dispatching request immediately. If NO, then request will start automatically. You will need to start it manually. Deffered starting asynchronous dispatching can be useful for additional configuring asynchronous request before running it.

asyncDispatch:withProxy:start:  protected    (declared in ROClientChannel)

For internal use

Prepares and return asynchronous request for dispatching the given message for given proxy.

This method relies on the internal method intAsyncDispatch:responseMessage: which implemenation depends on concrete client channel.

- (ROAsyncRequest *) asyncDispatch:(id)aMessage withProxy:(ROAsyncProxy *)proxy start:(BOOL)start

Parameters:

  • aMessage: instance of ROMessage that need to be dispatched
  • proxy: reference to the ROAsyncProxy which is stored in the result asynchronous request.

Later when asynchronous request completes, proxy can be used for obtaining request results. For example:

- (void) asyncRequestDidComplete:(ROAsyncRequest *)aRequest {
  ...
  if (aRequest.type == artGetDataTable) {
    NSData *data = [[request proxy] endGetData:aRequest];
    ...
  }
  ...
}
  • start: Boolean flag, If YES then it start dispatching request immediately. If NO, then request will start automatically. You will need to start it manually. Deffered starting asynchronous dispatching can be useful for additional configuring asynchronous request before running it.

asyncDispatch:withProxy:startWithBlock:  protected    (declared in ROClientChannel)

For internal use

Prepares and start asynchronous request with given completion block for dispatching the message for given proxy.

This method relies on the internal method intAsyncDispatch:responseMessage: which implemenation depends on concrete client channel.

- (ROAsyncRequest *) asyncDispatch:(id)aMessage withProxy:(ROAsyncProxy *)proxy startWithBlock:(void(^)(ROAsyncRequest *))block

Parameters:

  • aMessage: instance of ROMessage that need to be dispatched
  • proxy: reference to the ROAsyncProxy which is stored in the result asynchronous request.

Later when asynchronous request completes, proxy can be used for obtaining request results. For example:

- (void) asyncRequestDidComplete:(ROAsyncRequest *)aRequest {
  ...
  if (aRequest.type == artGetDataTable) {
    NSData *data = [[request proxy] endGetData:aRequest];
    ...
  }
  ...
}
  • block: completion block, will be called after asynchronous dispatching ends

channel  protected    (declared in ROClientChannel)

Returns a created channel

+ (id) channel

channelWithTargetUrl:  protected deprecated    (declared in ROClientChannel)

returns a new channel instance initialized with given NSURL

Deprecated. Please use channelWithTargetURL instead

+ (id) channelWithTargetUrl:(NSString *)targetUrl

Parameters:

  • targetUrl: Target URL as String

channelWithTargetURL:  protected    (declared in ROClientChannel)

returns a new channel instance initialized with given NSURL

+ (id) channelWithTargetURL:(NSURL *)targetUrl

Parameters:

  • targetUrl: Target URL

checkPackageSizeForData:

- (void) checkPackageSizeForData:(NSData *)aData

Parameters:

  • aData:

connectTimeout  assign

This value specifies the number of seconds for the channel to connect to a server and complete the handshaking. The default is 10 seconds.

@property (assign) int connectTimeout

decreaseNetworkActivityIndicator    (declared in ROClientChannel)

+ (void) decreaseNetworkActivityIndicator

delegate  protected assign    (declared in ROClientChannel)

Delegate object to receive events through the ROClientChannelDelegate protocol.

@property (assign) id delegate

dispatch:  protected    (declared in ROClientChannel)

for internal use Dispatches the given message synchronously. This method relies on the intDispatch: method provided by concrete client channel implementations for the actual dispatching.

- (void) dispatch:(id)aMessage

Parameters:

  • aMessage: instance of ROMessage that need to be dispatched

failAllPendingRequestsWithCode:exception:

- (void) failAllPendingRequestsWithCode:(unsigned int)aErrorCode exception:(ROException *)aException

Parameters:

  • aErrorCode:
  • aException:

forceSetActive:

- (void) forceSetActive:(BOOL)aValue

Parameters:

  • aValue:

getRequests

- (NSDictionary *) getRequests

handleAuthenticationChallenge:forHost:callback:    (declared in ROClientChannel)

+ (void) handleAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge forHost:(NSString *)host callback:(BOOL(^)(ROCertificateInfo *))block

Parameters:

  • challenge:
  • host:
  • block:

increaseNetworkActivityIndicator    (declared in ROClientChannel)

+ (void) increaseNetworkActivityIndicator

initWithTargetUrl:  protected deprecated    (declared in ROClientChannel)

- (InstanceType) initWithTargetUrl:(NSString *)aTargetUrl

Parameters:

  • aTargetUrl:

initWithTargetURL:  protected    (declared in ROClientChannel)

- (InstanceType) initWithTargetURL:(NSURL *)aTargetURL

Parameters:

  • aTargetURL:

isBusy  protected    (declared in ROClientChannel)

Property that shows is channel busy or not.

Actual implementation differs for different channels. For example syhchronous channels like HTTP channel can process only one request per moment. So using this property you can know does channel do something or its free for dispatching new messages.

@property (readonly) BOOL isBusy

maxPackageSize  assign

The maximum data size allowed to pass through the channel during the data exchange event (request, response, callback event). Expressed in kilobytes, the default is 1 Mb.

@property (assign) int maxPackageSize

newRequestOperationWithData:result:

- (void) newRequestOperationWithData:(NSData *)aData result:(ROSuperHTTPRequestOperation * *)aOp

Parameters:

  • aData:
  • aOp:

performLoginNeeded:forAsyncRequest:    (declared in ROClientChannel)

- (void) performLoginNeeded:(ROServerException *)exception forAsyncRequest:(ROAsyncRequest *)request

Parameters:

  • exception:
  • request:

performRequestOperation:result:

- (void) performRequestOperation:(ROSuperHTTPRequestOperation *)aOp result:(ROMessage *)aMessage

Parameters:

  • aOp:
  • aMessage:

reestablishWaitingConnection

- (void) reestablishWaitingConnection

removeRequestForPackageId:

- (void) removeRequestForPackageId:(int)aPackageId

Parameters:

  • aPackageId:

requestTimeout  assign

This property defines the maximum time within which the remote request can be executed on the server. The default is 60 seconds.

@property (assign) int requestTimeout

runLoop    (declared in ROClientChannel)

@property (readonly) NSRunLoop *runLoop

scheduleAsyncRequest:    (declared in ROClientChannel)

- (void) scheduleAsyncRequest:(ROAsyncRequest *)request

Parameters:

  • request:

scheduleOperation:

- (void) scheduleOperation:(ROSuperHTTPOperation *)aOperation

Parameters:

  • aOperation:

sessionId  retain

Allows to get or set the current client's session identifier. Normally this value is assigned by the server during the handshaking procedure (when the channel is being activated). It is not recommended to change the session ID value when the server is active because this can result in connection malfunction.

@property (retain) ROGuid *sessionId

setNeedReestablishWaitingConnection

- (void) setNeedReestablishWaitingConnection

storeHeaderFields:

- (void) storeHeaderFields:(NSURLRequest *)aRequest

Parameters:

  • aRequest:

targetUrl  protected copy deprecated    (declared in ROClientChannel)

This property keeps target URL as the string, for the channel. Since any things with URL in String format are deprecated, please use targetURL property instead.

@property (copy, deprecated) NSString *targetUrl

targetURL  protected copy    (declared in ROClientChannel)

Property keeps target URL, for the channel.

@property (copy) NSURL *targetURL

triggerOnLoginNeeded:    (declared in ROClientChannel)

- (BOOL) triggerOnLoginNeeded:(ROServerException *)exception

Parameters:

  • exception:

 

active  assign

Assigning a value to this property allows to activate and deactivate the server. The channel performs the handshaking procedure with the server when activated and will throw an exception if no answer was received from the server during connectTimeout interval (or the answer was invalid). It is recommended to set this property to NO when finishing the user application to shutdown the connection gracefully.
Both activating and deactivating operations are synchronous i.e. the control will not return to the calling code until all required operations are completed or an execption is raised.

@property (assign) BOOL active

activeClientChannelDelegate  assign

This property is used to connect the client channel and the ROEventReceiver instance to process incoming callback events. As a rule this property should not be assigned from the user code.

@property (assign) id<ROActiveClientChannelDelegate> activeClientChannelDelegate

connectTimeout  assign

This value specifies the number of seconds for the channel to connect to a server and complete the handshaking. The default is 10 seconds.

@property (assign) int connectTimeout

delegate  protected assign    (declared in ROClientChannel)

Delegate object to receive events through the ROClientChannelDelegate protocol.

@property (assign) id delegate

isBusy  protected    (declared in ROClientChannel)

Property that shows is channel busy or not.

Actual implementation differs for different channels. For example syhchronous channels like HTTP channel can process only one request per moment. So using this property you can know does channel do something or its free for dispatching new messages.

@property (readonly) BOOL isBusy

maxPackageSize  assign

The maximum data size allowed to pass through the channel during the data exchange event (request, response, callback event). Expressed in kilobytes, the default is 1 Mb.

@property (assign) int maxPackageSize

requestTimeout  assign

This property defines the maximum time within which the remote request can be executed on the server. The default is 60 seconds.

@property (assign) int requestTimeout

runLoop    (declared in ROClientChannel)

@property (readonly) NSRunLoop *runLoop

sessionId  retain

Allows to get or set the current client's session identifier. Normally this value is assigned by the server during the handshaking procedure (when the channel is being activated). It is not recommended to change the session ID value when the server is active because this can result in connection malfunction.

@property (retain) ROGuid *sessionId

targetUrl  protected copy deprecated    (declared in ROClientChannel)

This property keeps target URL as the string, for the channel. Since any things with URL in String format are deprecated, please use targetURL property instead.

@property (copy, deprecated) NSString *targetUrl

targetURL  protected copy    (declared in ROClientChannel)

Property keeps target URL, for the channel.

@property (copy) NSURL *targetURL

 

channel  protected    (declared in ROClientChannel)

Returns a created channel

+ (id) channel

channelWithTargetUrl:  protected deprecated    (declared in ROClientChannel)

returns a new channel instance initialized with given NSURL

Deprecated. Please use channelWithTargetURL instead

+ (id) channelWithTargetUrl:(NSString *)targetUrl

Parameters:

  • targetUrl: Target URL as String

channelWithTargetURL:  protected    (declared in ROClientChannel)

returns a new channel instance initialized with given NSURL

+ (id) channelWithTargetURL:(NSURL *)targetUrl

Parameters:

  • targetUrl: Target URL

decreaseNetworkActivityIndicator    (declared in ROClientChannel)

+ (void) decreaseNetworkActivityIndicator

handleAuthenticationChallenge:forHost:callback:    (declared in ROClientChannel)

+ (void) handleAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge forHost:(NSString *)host callback:(BOOL(^)(ROCertificateInfo *))block

Parameters:

  • challenge:
  • host:
  • block:

increaseNetworkActivityIndicator    (declared in ROClientChannel)

+ (void) increaseNetworkActivityIndicator

 

asyncDispatch:  protected deprecated    (declared in ROClientChannel)

For internal use

Dispatches the given message asynchronously and returns an ROAsyncRequest reference.

This method relies on the internal method intAsyncDispatch:responseMessage: which implemenation depends on concrete client channel.

This method is deprecated. If you will need to dispatch some mesages manually, then please use asyncDispatch:withProxy:start or asyncDispatch:withProxy:startWithBlock: instead

- (ROAsyncRequest *) asyncDispatch:(id)aMessage

Parameters:

  • aMessage: instance of ROMessage that need to be dispatched

asyncDispatch:start:  protected deprecated    (declared in ROClientChannel)

For internal use

Prepares and return asynchronous request for dispatching the given message.

This method relies on the internal method intAsyncDispatch:responseMessage: which implemenation depends on concrete client channel.

This method is deprecated. If you will need to dispatch some mesages manually, then please use asyncDispatch:withProxy:start or asyncDispatch:withProxy:startWithBlock: instead

- (ROAsyncRequest *) asyncDispatch:(id)aMessage start:(BOOL)start

Parameters:

  • aMessage: instance of ROMessage that need to be dispatched
  • start: Boolean flag, If YES then it start dispatching request immediately. If NO, then request will start automatically. You will need to start it manually. Deffered starting asynchronous dispatching can be useful for additional configuring asynchronous request before running it.

asyncDispatch:withProxy:start:  protected    (declared in ROClientChannel)

For internal use

Prepares and return asynchronous request for dispatching the given message for given proxy.

This method relies on the internal method intAsyncDispatch:responseMessage: which implemenation depends on concrete client channel.

- (ROAsyncRequest *) asyncDispatch:(id)aMessage withProxy:(ROAsyncProxy *)proxy start:(BOOL)start

Parameters:

  • aMessage: instance of ROMessage that need to be dispatched
  • proxy: reference to the ROAsyncProxy which is stored in the result asynchronous request.

Later when asynchronous request completes, proxy can be used for obtaining request results. For example:

- (void) asyncRequestDidComplete:(ROAsyncRequest *)aRequest {
  ...
  if (aRequest.type == artGetDataTable) {
    NSData *data = [[request proxy] endGetData:aRequest];
    ...
  }
  ...
}
  • start: Boolean flag, If YES then it start dispatching request immediately. If NO, then request will start automatically. You will need to start it manually. Deffered starting asynchronous dispatching can be useful for additional configuring asynchronous request before running it.

asyncDispatch:withProxy:startWithBlock:  protected    (declared in ROClientChannel)

For internal use

Prepares and start asynchronous request with given completion block for dispatching the message for given proxy.

This method relies on the internal method intAsyncDispatch:responseMessage: which implemenation depends on concrete client channel.

- (ROAsyncRequest *) asyncDispatch:(id)aMessage withProxy:(ROAsyncProxy *)proxy startWithBlock:(void(^)(ROAsyncRequest *))block

Parameters:

  • aMessage: instance of ROMessage that need to be dispatched
  • proxy: reference to the ROAsyncProxy which is stored in the result asynchronous request.

Later when asynchronous request completes, proxy can be used for obtaining request results. For example:

- (void) asyncRequestDidComplete:(ROAsyncRequest *)aRequest {
  ...
  if (aRequest.type == artGetDataTable) {
    NSData *data = [[request proxy] endGetData:aRequest];
    ...
  }
  ...
}
  • block: completion block, will be called after asynchronous dispatching ends

checkPackageSizeForData:

- (void) checkPackageSizeForData:(NSData *)aData

Parameters:

  • aData:

dispatch:  protected    (declared in ROClientChannel)

for internal use Dispatches the given message synchronously. This method relies on the intDispatch: method provided by concrete client channel implementations for the actual dispatching.

- (void) dispatch:(id)aMessage

Parameters:

  • aMessage: instance of ROMessage that need to be dispatched

failAllPendingRequestsWithCode:exception:

- (void) failAllPendingRequestsWithCode:(unsigned int)aErrorCode exception:(ROException *)aException

Parameters:

  • aErrorCode:
  • aException:

forceSetActive:

- (void) forceSetActive:(BOOL)aValue

Parameters:

  • aValue:

getRequests

- (NSDictionary *) getRequests

initWithTargetUrl:  protected deprecated    (declared in ROClientChannel)

- (InstanceType) initWithTargetUrl:(NSString *)aTargetUrl

Parameters:

  • aTargetUrl:

initWithTargetURL:  protected    (declared in ROClientChannel)

- (InstanceType) initWithTargetURL:(NSURL *)aTargetURL

Parameters:

  • aTargetURL:

newRequestOperationWithData:result:

- (void) newRequestOperationWithData:(NSData *)aData result:(ROSuperHTTPRequestOperation * *)aOp

Parameters:

  • aData:
  • aOp:

performLoginNeeded:forAsyncRequest:    (declared in ROClientChannel)

- (void) performLoginNeeded:(ROServerException *)exception forAsyncRequest:(ROAsyncRequest *)request

Parameters:

  • exception:
  • request:

performRequestOperation:result:

- (void) performRequestOperation:(ROSuperHTTPRequestOperation *)aOp result:(ROMessage *)aMessage

Parameters:

  • aOp:
  • aMessage:

reestablishWaitingConnection

- (void) reestablishWaitingConnection

removeRequestForPackageId:

- (void) removeRequestForPackageId:(int)aPackageId

Parameters:

  • aPackageId:

scheduleAsyncRequest:    (declared in ROClientChannel)

- (void) scheduleAsyncRequest:(ROAsyncRequest *)request

Parameters:

  • request:

scheduleOperation:

- (void) scheduleOperation:(ROSuperHTTPOperation *)aOperation

Parameters:

  • aOperation:

setNeedReestablishWaitingConnection

- (void) setNeedReestablishWaitingConnection

storeHeaderFields:

- (void) storeHeaderFields:(NSURLRequest *)aRequest

Parameters:

  • aRequest:

triggerOnLoginNeeded:    (declared in ROClientChannel)

- (BOOL) triggerOnLoginNeeded:(ROServerException *)exception

Parameters:

  • exception: