com.lightstreamer.ls_client
Interface ConnectionListener

All Known Subinterfaces:
ExtendedConnectionListener

public interface ConnectionListener

Receives notifications of connection activity and errors. The notification sequence follows the pattern:

[CE [SS (NB | DE | AW(true) AW(false) )* [AW(true)] [E | F1 | F2] C] ]

where F1 and F2 represent the two versions of onFailure(). A distinct listener must be used for any distinct connection opened.
All notifications are sent in sequence on a dedicated thread.


Method Summary
 void onActivityWarning(boolean warningOn)
          Notification that the connection is stalled (i.e. nothing has been received on the connection for more than the ConnectionInfo.probeWarningMillis timeout) or that the connection is working again after being notified as stalled.
 void onClose()
          Notification of the closure of the Connection.
 void onConnectionEstablished()
          Notification of the opening of the connection to the Server.
 void onDataError(PushServerException e)
          Notification that a block of data received from the Server could not be correctly interpreted.
 void onEnd(int cause)
          Notification of the closure of the Connection because of a Server side decision.
 void onFailure(PushConnException e)
          Notification of the closure of the Connection because of a connection problem.
 void onFailure(PushServerException e)
          Notification of the closure of the Connection because of an unrecoverable error in data coming from the Server.
 void onNewBytes(long bytes)
          Notification of the reception of some data bytes from the Server, for statistical purposes.
 void onSessionStarted(boolean isPolling)
          Notification that a session has been started by the Server on the connection.
 

Method Detail

onConnectionEstablished

void onConnectionEstablished()
Notification of the opening of the connection to the Server.


onSessionStarted

void onSessionStarted(boolean isPolling)
Notification that a session has been started by the Server on the connection.

Parameters:
isPolling - True if the session is in polling mode, false if the session is in streaming mode. The setting reflects the one requested with the LSClient.openConnection(com.lightstreamer.ls_client.ConnectionInfo, com.lightstreamer.ls_client.ConnectionListener) call unless the Stream-sense mechanism has been exploited.

onNewBytes

void onNewBytes(long bytes)
Notification of the reception of some data bytes from the Server, for statistical purposes.

Parameters:
bytes - Number of data bytes received.

onDataError

void onDataError(PushServerException e)
Notification that a block of data received from the Server could not be correctly interpreted. The implementation may consider this as a severe problem and open a new connection. In normal operation, this should not happen.

Parameters:
e - Exception that describes the problem occurred.

onActivityWarning

void onActivityWarning(boolean warningOn)
Notification that the connection is stalled (i.e. nothing has been received on the connection for more than the ConnectionInfo.probeWarningMillis timeout) or that the connection is working again after being notified as stalled.
If the connection is notified as stalled and nothing is received for more than the ConnectionInfo.probeTimeoutMillis timeout, then the connection is forcibly closed with an onFailure notification.

Parameters:
warningOn - if true, issues the warning for a stalled connection; otherwise resets a previously issued warning.

onClose

void onClose()
Notification of the closure of the Connection. It may be caused by a closeConnection call or by an unrecoverable error. There is no guarantee that calls to this listener will not be followed by further calls on some listener related to a table subscribed within the connection. Such extra calls should be ignored.


onEnd

void onEnd(int cause)
Notification of the closure of the Connection because of a Server side decision. Upon this notification, it is possible to perform recovery actions, such as trying a reconnection; however, it may be advisable not to try a new connection immediately.

Parameters:
cause - An integer code that describes the cause of the connection ending, or 0 if no cause information is supplied. See the "END" message in the text protocol documentation for details on the possible causes.

onFailure

void onFailure(PushServerException e)
Notification of the closure of the Connection because of an unrecoverable error in data coming from the Server. In normal operation, this should not happen.

Parameters:
e - Exception that describes the problem occurred.

onFailure

void onFailure(PushConnException e)
Notification of the closure of the Connection because of a connection problem.

Parameters:
e - Exception that describes the problem occurred.