Need Description about the error delegate methods

edited April 2012 in Native
In your Demo App you have implemented the error delegate methods as
- (void) connectionErrorReturn:(int)errorCode
- (void) clientErrorReturn:(int)errorCode
- (void) warningReturn:(int)warningCode
- (void) serverErrorReturn:(int)errorCode

In the ConnectionErrorReturn:(int)errorCode , you were putting the photon state to STATE_DISCONNECTED
- (void) connectionErrorReturn:(int)errorCode
{
	PhotonPeer_sendDebugOutput(mLoadBalancingClient, DEBUG_LEVEL_ERRORS, @" code: %d", errorCode);
	[mOutputListener writeLine:@"connection failed with error %d", errorCode];
	mStateAccessor.State = STATE_DISCONNECTED;
}

But for the remaining 3 error delegates you have not mentioned about the state. Can you explain about the last 3 error delegates in terms of photon state(disconnected or connected)?

Comments

  • Here is the according code from the LoadBalancingClient implementation:
    		case SC_EXCEPTION:
    		case SC_EXCEPTION_ON_CONNECT:
    		case SC_INTERNAL_RECEIVE_EXCEPTION:
    		case SC_TIMEOUT_DISCONNECT:
    		case SC_DISCONNECT_BY_SERVER:
    		case SC_DISCONNECT_BY_SERVER_USER_LIMIT:
    		case SC_DISCONNECT_BY_SERVER_LOGIC:
    			[mListener connectionErrorReturn:statusCode];
    			break;
    		case SC_SEND_ERROR:
    			[mListener clientErrorReturn:statusCode];
    			break;
    		case SC_QUEUE_OUTGOING_RELIABLE_WARNING:
    		case SC_QUEUE_OUTGOING_UNRELIABLE_WARNING:
    		case SC_QUEUE_OUTGOING_ACKS_WARNING:
    		case SC_QUEUE_SENT_WARNING:
    			[mListener warningReturn:statusCode];
    			break;
    		case ErrorCode::OPERATION_INVALID:
    		case ErrorCode::INTERNAL_SERVER_ERROR:
    			[mListener serverErrorReturn:statusCode];
    			break;
    
    A connection error means, that your client is not connected anymore (or never got connected, if you have got it initially). Therefor the demo is setting its state to disconnected.
    Both, a client side error or a server side error means, that you have not got disconnected (yet), otherwise you would have got a connection error, but you have got a serious error to deal with.
    The warningReturn will trigger, to warn you, that although there is no hard error, your client still is potentially in trouble and its strongly recommenced to react appropriately. Currently the only warnings, that can occur, are queue warnings. These will trigger, if some queues increase beyond certain limits. The default values for these limits are defined to such values (all currently defined defaults are set to 100), that crossing these limits will almost certainly mean, that you have a problem. To give you an example: If you would call sendOutgoingCommands() once every 100ms and you are having more than 100 commands in your outgoing queue, then this means, that you would need 10s until an operation, which you would now create, gets sent out. Accordingly getting such a warning means, that in some situations, you are just creating too much / too big ops, but sending the commands, which Photon is creating from them, not out quick enough, so you should either send less or call sendOutgotingCommands() more often, so that these warnings won't appear anymore: The right approach is, to handle occurrences of these warnings at development time, not at runtime, as when you are getting them, you will already have a very serious lag.
Sign In or Register to comment.