herculanojs Posted August 17, 2016 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; Quote
Oliver Morsch Posted August 17, 2016 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... Quote
Sherzod Posted August 17, 2016 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. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.