TsgcWebSocketHTTPServerEvents › OnSessionEnd

OnSessionEnd Event

Fires when an HTTP session is closed, either explicitly or after SessionTimeout expires.

Syntax

property OnSessionEnd: {$IFDEF INDY10_5_7} TIdHTTPSessionEndEvent {$ELSE} TOnSessionEndEvent {$ENDIF};
// {$IFDEF INDY10_5_7} TIdHTTPSessionEndEvent {$ELSE} TOnSessionEndEvent {$ENDIF} = procedure(Sender: TObject) of object

Default Value

Remarks

OnSessionEnd is raised when an HTTP session is removed from SessionList. This can happen when the application destroys the session explicitly (for example on logout) or when SessionTimeout expires without new activity from the client. Use it to release per-session resources, commit pending data, or log the session duration. The event signature depends on the underlying Indy version (INDY10_5_7 conditional); the session being closed is usually available through Sender. This event only fires when SessionState is True.

Example


procedure OnSessionEnd(Sender: TObject);
begin
  Log('session ended: ' + TIdHTTPSession(Sender).SessionID);
end;

Back to Events