The Lightstreamer Client SDK does not provide an option to configure a timeout such that if a connection cannot be established within the timeout, then the client is forced to give up.
However you can easily implement a similar functionality by using the same pattern that was discussed in your previous thread:
Code:
Timer timer = null;
void onStatusChange(status) {
if (status.equals("DISCONNECTED:WILL-RETRY")) {
if (timer == null) {
timer = new Timer();
timer.schedule(() -> {
if (!client.getStatus().startsWith("CONNECTED")) {
client.disconnect();
}
}, TIMEOUT);
}
}
}
Bookmarks