If your intent is to log off inactive users, you can add code to the "universal event" that set as static global variable (declared in Global Code: "stat VarName as int") to the server time using the @TimeInSeconds function. Because this will run every time there is any event, it will log the time of the last event.
last_event = @TimeInSeconds()
Place a call to RunEntryOnInteral in Global Code to kick off your timeout timer. It will call the On Entry Event code for the named element in the interval supplied as an argument in 1/1000ths of a second (i.e.: 1000 = 1 second). Here I am placing the entry code in the "First" element on the Customers sample application's Main Form.
stat last_event as int
last_event = 0
RunEntryOnInterval(First, 1000)
In the On Entry event for "First", place code that checks the current time in seconds against the time last recorded for an event. Don't worry, the On Entry event being kicked off by the timer does not qualify as a "universal event".
var now_time as int
var delta_time as int
now_time = @TimeInSeconds()
delta_time = now_time - last_event
if(delta_time > 10)
{
writeln("TIMEOUT: " + delta_time)
}
else
{
writeln("NO YET: " + delta_time)
}
RunEntryOnInterval(First, 1000)
As you can see., my timer checks at one second intervals, this is probably way too fast for your use. You should set the interval out for many minutes, if not hours before you knock a client off the server.
As for knocking the client off the server, should make sure you have closed as much as you can close using automation, then to actually disconnect and shutdown the client, you call ExitSesame().
Please, write this code with the greatest care. Knocking folk off of their connection when they have stepped away, or because your code doesn't take something into consideration, is going to upset your users - especially if they were carefully looking over a form but not actually interacting with it (reading a report and planning to update the form soon, etc...)
Also, be aware that the code above can only work with a form active. The timer callback, the universal event, only operate with a form open. Additionally, I have seen that you may have to initiate the first interval timer by actually entering the named element, placing it in global code by itself is not enough because the form is not necessarily open and active when global code is run.
If your intent is to determine that a user has been kicked off by an external (not sesame) program, like their ISP has timed them out on a dial up line, you probably can't do that using coding (though something really tricky using a server side mass update might be possible, but ill-advised). The Sesame server does attempt, using a heartbeat, to determine if a connection has been severed, but the timeout is very long to avoid knocking off clients with particularly slow connections. The next version of Sesame has a lot of new code for addressing and diagnosing network reliability issues.
The sys internals folk (now, sadly, a division of MS) have some tools that will allow you to see and analyze your network connections on the server, if you are running Windows. Linux comes with such tools right out of the box.