TsgcWebSocketClientProperties › LastError

LastError Property

Read-only string with the description of the most recent error raised by the client.

Syntax

property LastError: string read FLastError;

Default Value

'' (empty string)

Remarks

Whenever the component reports a failure through OnError or OnException, the error text is also stored in LastError, so the reason of a failed operation can be read afterwards without handling those events. The value is cleared automatically before each new connection attempt made with Connect. The Connect overload with an out AError parameter returns this value directly when the connection fails. An empty string means no error has been recorded.

Example


oClient := TsgcWebSocketClient.Create(nil);
oClient.URL := 'wss://www.esegece.com:2053';
if not oClient.Connect(5000) then
  ShowMessage('Connection failed: ' + oClient.LastError);

Back to Properties