TsgcWebSocketHTTPServerEvents › OnSessionStart

OnSessionStart Event

Fires when an HTTP session is started and added to the SessionList.

Syntax

property OnSessionStart: {$IFDEF INDY10_5_7} TIdHTTPSessionStartEvent {$ELSE} TOnSessionStartEvent {$ENDIF};
// {$IFDEF INDY10_5_7} TIdHTTPSessionStartEvent {$ELSE} TOnSessionStartEvent {$ENDIF} = procedure(Sender: TObject) of object

Default Value

Remarks

OnSessionStart is raised after a new HTTP session has been added to the SessionList, either automatically when AutoStartSession is True or explicitly by calling SessionList.CreateSession from OnCommandGet. Use it to initialize per-session data structures, emit an audit trail, or warm caches for the new user. The event signature depends on the underlying Indy version (INDY10_5_7 conditional); recent Indy builds expose the TIdHTTPSession instance via Sender. This event only fires when SessionState is True.

Example


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

Back to Events