com.threerings.presents.client
Interface ClientObserver

All Superinterfaces:
SessionObserver
All Known Implementing Classes:
Client.ServerSwitcher, ClientAdapter, PeerNode, TestClient

public interface ClientObserver
extends SessionObserver

A client observer is a more detailed version of the SessionObserver for entities that are interested in more detail about the logon/logoff process.

In the normal course of affairs, SessionObserver.clientDidLogon(com.threerings.presents.client.Client) will be called after the client successfully logs on to the server and SessionObserver.clientDidLogoff(com.threerings.presents.client.Client) will be called after the client logs off of the server. If logon fails for any reason, clientFailedToLogon(com.threerings.presents.client.Client, java.lang.Exception) will be called to explain the failure.

clientWillLogoff(com.threerings.presents.client.Client) will only be called when an abortable logoff is requested (like when the user clicks on a logoff button of some sort). It will not be called during non-abortable logoff requests (like when the browser calls stop on the applet and is about to yank the rug out from under us). If an observer aborts the logoff request, it should notify the user in some way why the request was aborted (but it shouldn't do so on the thread that calls clientWillLogoff(com.threerings.presents.client.Client)).

If the client connection fails unexpectedly, clientConnectionFailed(com.threerings.presents.client.Client, java.lang.Exception) will be called to let the observers know that we lost our connection to the server. SessionObserver.clientDidLogoff(com.threerings.presents.client.Client) will be called immediately afterwards as a normal logoff procedure is effected.


Method Summary
 void clientConnectionFailed(Client client, Exception cause)
          Called when the connection to the server went away for some unexpected reason.
 void clientDidClear(Client client)
          Called after the client is completely logged off from a successful session and is ready to reconnect to a new server if desired.
 void clientFailedToLogon(Client client, Exception cause)
          Called if anything fails during the logon attempt.
 boolean clientWillLogoff(Client client)
          Called when an abortable logoff request is made.
 
Methods inherited from interface com.threerings.presents.client.SessionObserver
clientDidLogoff, clientDidLogon, clientObjectDidChange, clientWillLogon
 

Method Detail

clientFailedToLogon

void clientFailedToLogon(Client client,
                         Exception cause)
Called if anything fails during the logon attempt. This could be a network failure, authentication failure or otherwise. The exception provided will indicate the cause of the failure.

Parameters:
cause - an exception indicating the cause of the logon failure. Note: this may be a LogonException and if so, the caller must check LogonException.isStillInProgress() to find out if the logon process has totally failed or if we are simply reporting intermediate status (we might be falling back to an alternative port or delaying our auto-retry attempt due to server overload).

clientConnectionFailed

void clientConnectionFailed(Client client,
                            Exception cause)
Called when the connection to the server went away for some unexpected reason. This will be followed by a call to SessionObserver.clientDidLogoff(com.threerings.presents.client.Client).


clientWillLogoff

boolean clientWillLogoff(Client client)
Called when an abortable logoff request is made. If the observer returns false from this method, the client will abort the logoff request.


clientDidClear

void clientDidClear(Client client)
Called after the client is completely logged off from a successful session and is ready to reconnect to a new server if desired. This will only be called after an active session was terminated, not after a logon attempt failed as that failure will be reported by clientFailedToLogon(com.threerings.presents.client.Client, java.lang.Exception).