herculanojs Posted August 17, 2016 Share Posted August 17, 2016 Hello friends, I'm trying to notify the session on its closure. But the message is not displayed This function is for this reason, or is there some other way to communicate the session that it will be closed. unisession.ShowAlert('A sessão será finalizada dentro de cinco minutos para atualização do sistema'); unisession.TerminateAfterSecs(60); try AServerUpdating := true; S := UniServerModule.SessionManager.Sessions; S.Lock; for I := 0 to S.SessionList.Count - 1 do begin USession := S.SessionList; USession.ShowAlert('Sua sessão será finalizada em 5 (cinco) minutos para atualização do sistema.'); USession.TerminateAfterSecs(60); end; finally S.Unlock; end; Link to comment Share on other sites More sharing options...
Oliver Morsch Posted August 17, 2016 Share Posted August 17, 2016 This can't work with HTTP. HTTP is always: Request (from Client) -> Answer (from server). In Your Example, there are no Requests (from the different sessions), so the server can't give an answer. You need long polling or web sockets... Link to comment Share on other sites More sharing options...
Sherzod Posted August 17, 2016 Share Posted August 17, 2016 Hi, I think for your issue, you can use uniTimer with an interval a few minutes.. 1. UniServerModule: public { Public declarations } globalTerminate: Boolean; end; 2. procedure TMainForm.UniTimer1Timer(Sender: TObject); begin // UniTimer->Interval = 60000 if UniServerModule.globalTerminate then begin (Sender as TUniTimer).Enabled := False; ShowMessage('Sua sessão será finalizada em 5 (cinco) minutos para atualização do sistema.'); end; end; 3. try UniServerModule.globalTerminate := true; //<--- AServerUpdating := true; S := UniServerModule.SessionManager.Sessions; S.Lock; for I := 0 to S.SessionList.Count - 1 do begin USession := S.SessionList[I]; //USession.ShowAlert('Sua sessão será finalizada em 5 (cinco) minutos para atualização do sistema.'); USession.TerminateAfterSecs(120); end; finally S.Unlock; end; Best regards. Link to comment Share on other sites More sharing options...
herculanojs Posted August 17, 2016 Author Share Posted August 17, 2016 tanks Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now