ROClientChannelDelegate

Overview

This article describes the informal protocol that allows to get feedback from the client channel (ROClientChannel descendant) about connection progress. This includes data flow tracking, login (RO approach, see Authentication and Login) and exception handling.
All protocol methods are optional.

Location

Optional Methods


clientChannel:didReceiveDataSize:ofExpected:

Informs the delegate object that all or part of the response data have been received from the server. Implement this delegate method if you want to track the incoming data flow.

@optional - (void) clientChannel:(ROClientChannel *)channel didReceiveDataSize:(int)size ofExpected:(int)totalSize

Parameters:

  • channel: The channel object that receives the data.
  • size: Total number of bytes currently received by the channel object. This number increases step by step and reaches totalSize value with the last packet.
  • totalSize: Total number of bytes to be received (server response length).

clientChannel:didSendDataSize:ofExpected:

Informs the delegate object that all or part of the request data have been sent to the server. Implement this delegate method if you want to track the outgoing data flow.

@optional - (void) clientChannel:(ROClientChannel *)channel didSendDataSize:(int)size ofExpected:(int)totalSize

Parameters:

  • channel: The channel object that sends the data.
  • size: Total number of bytes currently sent by the channel object. This number increases step by step and reaches totalSize value with the last packet.
  • totalSize: Total number of bytes to be sent to the server (request length).

clientChannel:requestDidFailWithException:

Informs the delegate object that an exception was thrown while dispatching the message. This method will not be called for SessionNotFoundException, because it is related to the login sequence. The method will be called before the exception is rethrown to the upper level. You cannot forbid exceptions to be rethrown.
Implement this method if you want to be informed about the exception before it is thrown at application level.

@optional - (void) clientChannel:(ROClientChannel *)channel requestDidFailWithException:(NSException *)exception

Parameters:

  • channel: The channel object that dispatches the message.
  • exception: Exception object to be thrown.

clientChannelDidFinishLogin:

In the case of , the delegate object is informed that the login sequence related to the client channel has finished, either successfully or not.

@optional - (void) clientChannelDidFinishLogin:(ROClientChannel *)channel

Parameters:

  • channel: The channel the login sequence was related to.

clientChannelDidSuspendRequestAwaitingLogin:

@optional - (void) clientChannelDidSuspendRequestAwaitingLogin:(ROClientChannel *)channel

Parameters:

  • channel:

clientChannelNeedsLogin:

Informs the delegate method that the login procedure must be performed before any remote request can be successfully completed. According to RO's Authentication and Login approach, the SessionNotFoundException exception will be thrown if login is required. This exception is handled internally and the clientChannelNeedsLogin delegate method is called instead of standard exception processing.
The delegate method returns YES if the login procedure succeeded and the original remote request will be repeated. In case of login failure NO will be returned and the remote request execution will be canceled.
Notice: in the case of , this method will be performed on the worker thread, not on the application's main thread.
Implement this method if the standard authentication approach is used.

@optional - (BOOL) clientChannelNeedsLogin:(ROClientChannel *)channel

Parameters:

  • channel: The channel the login sequence is related to.

clientChannelNeedsLoginOnMainThread:

The role of this method is same as above but it is performed on the main application thread. You should use this method if your code can only be be executed on the main thread.

@optional - (BOOL) clientChannelNeedsLoginOnMainThread:(ROClientChannel *)channel

Parameters:

  • channel: The channel the login sequence was related to.

clientChannelWillBeginLogin:

In case of , the delegate object will be informed that the login sequence related to the client channel will be initiated.

@optional - (void) clientChannelWillBeginLogin:(ROClientChannel *)channel

Parameters:

  • channel: The channel the login sequence will be related to.