4D v16Managing 4D Mobile sessions |
||
|
4D v16
Managing 4D Mobile sessions
Managing 4D Mobile sessions
Starting with 4D v15 R4, it is possible to access the ID of a 4D Mobile session on the 4D Server by programming. This feature allows developers to get or set session-related information locally (see example below). 4D Mobile sessions are handled using regular 4D Web session commands. Several 4D Web commands, as well as the WEB Get session process count command and the On Web Close Process database method support 4D Mobile sessions. 4D Mobile sessions and Web sessions are two different kinds of sessions. Although they share some concepts (and commands), they do not have the same properties. The main difference is the relation between a session, a process and the process context:
As a result, the sharing of information related to the session between 4D Mobile Web processes requires specific implementations on 4D Server. The following existing Web session handling commands support 4D Mobile sessions. The WEB CLOSE SESSION command closes the 4D Mobile session whose ID is passed in sessionID. Since a 4D Mobile session can handle several processes, this command actually requests all related Web processes to terminate their execution. The WEB Get Current Session ID command returns the UUID associated with the current 4D Mobile session. The WEB GET SESSION EXPIRATION command returns expiration information related to the cookie of a 4D Mobile session. The same cookie is used for all processes attached to a 4D Mobile session. The WEB Get session process count command allows you to find out the number of existing processes related to a given session.
The On Web Close Process database method is called by 4D each time a Web process is about to finish its execution. It fully supports 4D Mobile session processes: in this context, it is called for each Web process closed, allowing you to save any data (variable, selection, etc.) generated by the 4D Mobile session process. Note: For regular Web sessions, the On Web Close Process database method database method is called each time the Web session, i.e. the Web session unique process, is closed. If you want to share or reuse information between several processes of a single 4D Mobile session, you can use the UUID of the 4D Mobile session to identify session-related data. For example, after a query of records, you want to keep a named selection on the 4D Server so that any subsequent REST request in the same session will be able to access this selection directly. You can write, after the query statement: //create an interprocess selection including session UUID
See also
|
PROPERTIES
Product: 4D
HISTORY
Created: 4D v15 R4 ARTICLE USAGE
4D Mobile ( 4D v16) |