StreamLink has in-built reconnection which means that, should connection to the server go down, the StreamLink client will continue to attempt to re-establish a connection indefinitely.
Follow the steps below:
- Use the test client to establish a connection to Liberator. Once a connection is established, make a subscription e.g. /FX/GBPUSD.
- The test client has two "reconnect" buttons which both simulate disconnecting from the server and automatically reconnecting within 10 seconds. Press the "reconnect 1" button on the test page. The updates will stop as StreamLink has been disconnected from the server. After 10 seconds, the connection is re-establised but price updates do not resume.
- Re-subscribe to the same currency pair.
- Press the "reconnect 2" button on the test page. Again, the updates will stop. This time they are resumed when the test client reconnects.
- Take a look at the Liberator session-rttpd.log file. Can you spot the difference between the two reconnections?
In the first case the client explicitly reconnects. Such an incident means that the client application is not implemented correctly.
<timestamp>: 127.0.0.1 8 OPEN 0sYDcw8wcW1GI3TN_RxEbZ <timestamp>: 127.0.0.1 8 LOGIN_OK admin SLJS 0sYDcw8wcW1GI3TN_RxEbZ LOGIN_OK <timestamp>: 127.0.0.1 8 LOST admin SLJS 0sYDcw8wcW1GI3TN_RxEbZ CLOSE_TYPE2 <timestamp>: 127.0.0.1 8 OPEN 0Cx07zOhGtnmmNcp8kIP55 <timestamp>: 127.0.0.1 8 LOGIN_OK admin SLJS 0Cx07zOhGtnmmNcp8kIP55 LOGIN_OK <timestamp>: 127.0.0.1 8 CLOSE admin SLJS 0sYDcw8wcW1GI3TN_RxEbZ TIMEOUT
The second reconnection is carried out by default when a connection is lost and then regained. StreamLink is automatically reconnects to the server and resumes all previous subscriptions on a new session. The previous session is closed (reason: RECONNECTED).
<timestamp>: 127.0.0.1 8 LOST admin SLJS 0Cx07zOhGtnmmNcp8kIP55 CLOSE_TYPE2 <timestamp>: 127.0.0.1 8 OPEN 0nOr_SUJjEs3RfoEuRbnnP <timestamp>: 127.0.0.1 8 RECONNECT_OK admin SLJS 0nOr_SUJjEs3RfoEuRbnnP 0Cx07zOhGtnmmNcp8kIP55 LOGIN_OK <timestamp>: 127.0.0.1 8 CLOSE admin SLJS 0Cx07zOhGtnmmNcp8kIP55 RECONNECTED