Interface representing a single, connected login session between a client and the server. Classes that implement {@code ClientSession} must also implement {@link Serializable}.
When a client logs in, the application's {@link AppListener#loggedIn(ClientSession) AppListener.loggedIn} method isinvoked with a new {@code ClientSession} instance which represents thecurrent connection between that client and the server. By returning a unique {@link ClientSessionListener} from the {@code loggedIn} methodfor each given client session, the application will receive notification when a client session sends a message, is disconnected, or logs out. To explicitly disconnect a {@code ClientSession}, remove the associated {@code ClientSession} object from the data manager using the {@link DataManager#removeObject DataManager.removeObject} method.
A {@code ClientSession} is used to identify a client that islogged in, to send messages to that client, and to forcibly disconnect that client from the server.
A session is considered disconnected if one of the following occurs:
- the client logs out
- the client becomes disconnected due to a network failure, and a connection to the client cannot be re-established in a timely manner
- the {@code ClientSession} object is removed from the data manager
If a client associated with a {@code ClientSession} becomesdisconnected due to one of these conditions, the {@link ClientSessionListener#disconnected(boolean) disconnected} method isinvoked on that session's registered {@code ClientSessionListener} with a {@code boolean} thatif {@code true} indicates the client logged out gracefully.
Once a client becomes disconnected, its {@code ClientSession}becomes invalid and can no longer be used to communicate with that client and should be removed from the data manager. When that client logs back in again, a new session is established with the server.