TsgcWebSocketHTTPServer › Events › OnCreateSession
Fires when the HTTP server needs to create a new session so the application can supply a custom TIdHTTPSession instance.
property OnCreateSession: {$IFDEF INDY10_5_7} TIdHTTPCreateSession {$ELSE} TOnCreateSession {$ENDIF};
// {$IFDEF INDY10_5_7} TIdHTTPCreateSession {$ELSE} TOnCreateSession {$ENDIF} = procedure(Sender: TObject) of object
—
OnCreateSession is called by the underlying Indy HTTP server when SessionState is True and a new session record is about to be allocated (typically when a request arrives without a valid session cookie and AutoStartSession is True). The actual event signature is supplied by Indy and varies between versions, hence the INDY10_5_7 conditional in the declaration. The handler gives the application a chance to log session creation or to provide its own TIdHTTPSession descendant for the session list. Most applications will not need to handle this event; use OnSessionStart to react when a session effectively becomes active, and TsgcWebSocketHTTPServer.SessionList.CreateSession/GetSession to manipulate sessions manually.
procedure OnCreateSession(Sender: TObject);
begin
Log('new HTTP session allocated');
end;