Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Timeout response
#8
(02-08-2019, 09:51 AM)Jose Nilton Pace Wrote: Hi Ioan. Every Form has a property KeepAlive, just set it to true.
IW can do this for you in the same way as you said to put iwtimer in all forms.
Remove the iwtimer and set KeepAlive := True;

Hi Jose,

Is there a event handler for the KeepAlive messages? In my implementation I count how many times the HeartbeatTimer timer fires and for some parts of the web application I allow it to time out, something like this:



Code:
procedure TformUserMenu.HeartbeatTimerAsyncTimer(Sender: TObject; EventParams: TStringList);
begin
  StopHeartbeatTimer(HeartbeatTimer);
end;

procedure StopHeartbeatTimer(AHeartbeatTimer: TIWTimer; ACount: integer);
var
  iHeartbeats: integer;
begin
  if ACount > 0 then
    iHeartbeats := ACount
  else
  // a hearthbeat is every 20 seconds, so the timeout its (iHeartbeats * 20) seconds.
  if UserSession.LevelString = 'USER' then
    iHeartbeats := 30
  else if (UserSession.LevelString = 'AGENT') or (UserSession.LevelString = 'COMPANY') then
    iHeartbeats := 45
  else
    Exit; // do not timeout

  if AHeartbeatTimer.Tag > iHeartbeats then
    AHeartbeatTimer.Enabled := false;
  AHeartbeatTimer.Tag := AHeartbeatTimer.Tag + 1;
end;
Reply


Messages In This Thread
Timeout response - by lfeliz - 02-02-2019, 07:10 AM
RE: Timeout response - by lfeliz - 02-02-2019, 04:42 PM
RE: Timeout response - by lfeliz - 02-02-2019, 10:28 PM
RE: Timeout response - by Jose Nilton Pace - 02-03-2019, 12:49 PM
RE: Timeout response - by lfeliz - 02-05-2019, 12:37 AM
RE: Timeout response - by ioan - 02-07-2019, 09:33 PM
RE: Timeout response - by Jose Nilton Pace - 02-08-2019, 09:51 AM
RE: Timeout response - by ioan - 02-08-2019, 07:14 PM
RE: Timeout response - by DanBarclay - 02-09-2019, 01:56 AM

Forum Jump:


Users browsing this thread: 2 Guest(s)