To save the time, I got it from an example
var
S : TUniGUISessions;
U : TUniGUISession;
i , nr: Integer;
ASessionList : array of TUniSessionInfoRec;
begin
S := UniServerModule.SessionManager.Sessions;
nr:=S.SessionList.Count;
S.Lock;
// Using Lock on session manager should be used with extreme care.
// We should keep this "Lock" active as short as we can. Session Manager stops working until lock is released.
// Excessive use of lock/unlock or keeping the lock active for a long period will make uniGUI server slow/unresponsive.
try
SetLength(ASessionList, S.SessionList.Count);
// Here we do a fast copy of list to another array for later use.
nr:= S.SessionList.Count - 1;
for i := 0 to nr do
begin
U := S.SessionList;
ASessionList.ASessionId := U.SessionId;
ASessionList.AIP := U.RemoteIP;
ASessionList.ALastTime := U.LastTimeStamp;
end;
finally
S.Unlock; // ... and finally don't forget to release lock!
end;