TsgcSSEClient › Properties › ReconnectOptions

ReconnectOptions Property

Controls the automatic reconnection after the stream ends or a network error happens.

Syntax

property ReconnectOptions: TsgcSSEClient_ReconnectOptions read FReconnectOptions write SetReconnectOptions;

Default Value

Enabled = True, Interval = 3000

Remarks

The client reconnects when the stream ends or a network error happens, and it sends the Last-Event-ID header so the server can resume the stream. It does not reconnect when the server answers with an HTTP status other than 200, or with a content type other than text/event-stream. A status 204 stops the client without an error.

The final delay of every attempt can still be changed or cancelled from the OnReconnect event.

Example


oSSE.ReconnectOptions.Enabled := True;
oSSE.ReconnectOptions.Interval := 1000;
oSSE.ReconnectOptions.MaxAttempts := 10;
oSSE.ReconnectOptions.Backoff := True;
oSSE.ReconnectOptions.BackoffMultiplier := 2.0;
oSSE.ReconnectOptions.MaxInterval := 30000;
oSSE.ReconnectOptions.Jitter := 0.2;

Back to Properties