TsgcWebSocketLoadBalancerServerEvents › OnError

OnError Event

Fires when the load balancer detects an error on one of its accepted connections.

Syntax

property OnError: TsgcWSErrorEvent;
// TsgcWSErrorEvent = procedure(Connection: TsgcWSConnection; const Error: string) of object

Default Value

Remarks

OnError is raised for non-fatal errors detected while handling a connection: malformed frames, protocol violations, failures during forwarding to a backend, or I/O errors reported by the Indy layer. Connection is the affected session (may be a client or a backend connection) and Error contains a human-readable description. Use the event for logging and metrics; use OnException when you need access to the actual exception object.

Example


procedure OnError(Connection: TsgcWSConnection; const Error: string);
begin
  Log('Error on ' + Connection.Guid + ': ' + Error);
end;

Back to Events