wwatts
Is there a way through the .NET API to cause the connection to be re-established after a failure? For example, using the StockList demo if the client is up and Lightstreamer server is shutdown, the client detects the connection loss. However, if Lightstreamer is restarted it appears the client is not re-connected. This is different from the web-based client which re-connects.
If it is not part of the API, what is the suggested design for handling this situation? Is it acceptable to start a thread that periodically attempts to connect to Lightstreamer and when successful terminate the thread?
Thanks in advance for the help.
Dario Crivelli
I confirm that such recovery mechanisms are not part of the API, as application code has full control of the case and could perform the recovery in the most convenient way.
A loop of periodic invocations to OpenConnectionon a single LSClient object is suitable;
as soon as OpenConnection returns (that is, it does not throw any exception) the connection is established and the loop can terminate.
Note that there is no internal check on the time OpenConnection takes to return.
If adding a custom timeout check should turn out to be useful, however, a new LSClient instance would be needed in order to start a new parallel attempt.
Also note that, unlike the Web Client, upon disconnection the current subscriptions are discarded and will not be automatically reissued after a successful reconnection, despite that the same LSClient object instance is used.