public interface ClientListener
LightstreamerClient
events comprehending notifications of
connection activity and errors. ClientListener
s, SubscriptionListener
s and ClientMessageListener
s will be dispatched by the
same thread.Modifier and Type | Method and Description |
---|---|
void |
onListenEnd(LightstreamerClient client)
Event handler that receives a notification when the ClientListener instance is removed from a LightstreamerClient
through
LightstreamerClient.removeListener(ClientListener) . |
void |
onListenStart(LightstreamerClient client)
Event handler that receives a notification when the ClientListener instance is added to a LightstreamerClient
through
LightstreamerClient.addListener(ClientListener) . |
void |
onPropertyChange(java.lang.String property)
Event handler that receives a notification each time the value of a property of
LightstreamerClient.connectionDetails or LightstreamerClient.connectionOptions
is changed. |
void |
onServerError(int errorCode,
java.lang.String errorMessage)
Event handler that is called when the Server notifies a refusal on the client attempt to open
a new connection or the interruption of a streaming connection.
|
void |
onStatusChange(java.lang.String status)
Event handler that receives a notification each time the LightstreamerClient status has changed.
|
void onListenEnd(@Nonnull LightstreamerClient client)
LightstreamerClient.removeListener(ClientListener)
. This is the last event to be fired on the listener.client
- the LightstreamerClient this instance was removed from.void onListenStart(@Nonnull LightstreamerClient client)
LightstreamerClient.addListener(ClientListener)
. This is the first event to be fired on the listener.client
- the LightstreamerClient this instance was added to.void onServerError(int errorCode, @Nonnull java.lang.String errorMessage)
onStatusChange(java.lang.String)
event handler has already been invoked
with a "DISCONNECTED" status and no recovery attempt has been performed.
By setting a custom handler, however, it is possible to override this and perform custom recovery actions.errorCode
- The error code. It can be one of the following:
errorMessage
- The description of the error as sent by the Server.onStatusChange(String)
,
ConnectionDetails.setAdapterSet(String)
void onStatusChange(@Nonnull java.lang.String status)
LightstreamerClient.disconnect()
) or by internal
actions.
The normal cases are the following:
LightstreamerClient.disconnect()
, the status will switch to "DISCONNECTED".onServerError(int, java.lang.String)
event handler will be invoked.ConnectionOptions.setStalledTimeout(long)
). If the unavailability ceases, the status
will switch back to "CONNECTED:*-STREAMING"; otherwise, if the unavailability persists
(see ConnectionOptions.setReconnectTimeout(long)
), the status will switch to "DISCONNECTED:TRYING-RECOVERY"
and eventually to "CONNECTED:*-STREAMING".onServerError(int, java.lang.String)
event handler will be invoked.ConnectionOptions.setSlowingEnabled(boolean)
, in case of slow update processing,
the status may switch from "CONNECTED:WS-STREAMING" to "CONNECTED:WS-POLLING" or from "CONNECTED:HTTP-STREAMING"
to "CONNECTED:HTTP-POLLING".ConnectionOptions.setForcedTransport(String)
, only the
related final status or statuses are possible.ConnectionOptions.setRetryDelay(long)
),
then to "CONNECTING" and a new attempt will start.
However, in most cases, the client will try to recover the current session;
hence, the "DISCONNECTED:TRYING-RECOVERY" status will be entered and the recovery attempt will start.LightstreamerClient.connect()
and LightstreamerClient.disconnect()
, as any other method, can
be issued directly from within a handler.status
- The new status. It can be one of the following values:
ConnectionOptions.setSlowingEnabled(boolean)
).LightstreamerClient.connect()
call is issued.LightstreamerClient.connect()
,
LightstreamerClient.disconnect()
,
LightstreamerClient.getStatus()
void onPropertyChange(@Nonnull java.lang.String property)
LightstreamerClient.connectionDetails
or LightstreamerClient.connectionOptions
is changed. property
- the name of the changed property.
LightstreamerClient.connectionDetails
,
LightstreamerClient.connectionOptions