Connection Listeners
Definition
The connection listeners are client side objects handler that are registered with the ServerContext and are invoked when the connection is disconnected. Connection listeners are necessary when the client registers with the server to receive information through client callbacks and the user must be informed if the socket connection to the server is closed. The datasynch sample registers a connection listener that prints a disconnect message:
package com.accendia.datasynch.client;

import com.accendia.iris.client.IConnectionListener;

/**
 * Notifies the client the connection was dropped.
 */
public class ConnectionHandler implements IConnectionListener
{
	/**
	 * Prints a disconnect message to the console.
	 */
	public void disconnected()
	{
		System.out.println( "CONNECTION DISCONNECTED" );
	}
}

Connection Listener Registration
The connection listener must be instantiated and registered with the ServerContext:
IConnectionListener connectionListener = new ConnectionHandler();
serverContext.addConnectionListener( connectionListener );