USER_AGENT
The USER_AGENT
element sets a timeout to handle the user agent session.
Syntax
<USER_AGENT>seconds</USER_AGENT>
- seconds specifies the number of seconds to wait for a client request. If not specified, the default timeout is 300 seconds.
Child elements
There are no child elements.
Usage
Set this timeout to specify a number of seconds that the GAS is to wait for a client request before assuming that the front-end has died or that there has been a network failure.
The USER_AGENT
is managed by the session. A session is started with the first
application. If the first application starts several child applications, these applications become
part of the session. The USER_AGENT
does not time out while any one of these
applications has activity.
To keep the application alive in case of user inactivity, the front-end regularly sends a ping request to the GAS.
USER_AGENT
timeout value to the Genero Browser Client at
application start up, it divides it by 2. This helps ensure the GAS has time to receive at least one
ping from the client if network traffic is experiencing very high latency. For example, where the
USER_AGENT
value is 300, the X-FourJs-Timeout
response header
contains 150:X-FourJs-Timeout: 150
When does a session time out?
A session times out when the client has not sent a request to the GAS before the USER_AGENT
timeout expires. When this occurs, the GAS assumes that the front-end has died and sends an
instruction to close the socket to the DVM, which causes the DVM to shut down.
OPTIONS ON CLOSE APPLICATION
callback function set in order to
try to release resources when a timeout occurs, this code is executed before the DVM shuts down. For
more information on handling front-end termination, see the Front-end termination page
in Genero Business Development Language User Guide.In case of normal application termination (using the application close button), the ON
CLOSE APPLICATION
callback is not called.
The USER_AGENT
timeout proves to be particularly useful with applications
running in the Genero web client. As with the other front-ends, when a user properly exits via the
application close button, the DVM handling that application is properly shut down.
Common ways sessions time out
- If the user does not exit the application using the application close button, the session may
stay alive. For instance, if a user closes the browser instead of using the application close
button, the session may stay alive until the
USER_AGENT
time out is reached. - Another scenario is when a child application in the session is closed. The front-end sends a
closing instruction, but that may in some circumstances, such as closing the browser tab, not reach
the GAS. In this case the child DVM keeps on
running on your server until the main application is exited or has reached the
USER_AGENT
time out.
We recommend that you properly exit applications using the application close actions.
Usage example
<USER_AGENT>300</USER_AGENT>
In this example, the USER_AGENT
timeout is set to 300 seconds.