TsgcHTTPServer › Events › OnConnect

OnConnect Event

Fires every time a client connection is established.

Syntax

property OnConnect: TsgcWSConnectEvent;
// TsgcWSConnectEvent = procedure(Connection: TsgcWSConnection) of object

Default Value

—

Remarks

OnConnect is raised after a client connection has been accepted and is ready to exchange HTTP requests. The Connection parameter identifies the new session and exposes its Guid, PeerIP, authentication state, and custom tag. Use OnTCPConnect to be notified the moment the TCP socket is accepted, before the HTTP layer takes over.

Example


procedure OnConnect(Connection: TsgcWSConnection);
begin
  Log('Client connected: ' + Connection.Guid + ' from ' + Connection.PeerIP);
end;

Back to Events