As you probably know, scalable sessions have been available since 4D v18 R6. They’re a web session type that is able to handle several processes in preemptive mode. This means they can handle several user-agent requests simultaneously and share data between these processes.
Well, 4D v19 R7 greatly enhances this feature and makes it available to 4D for Mobile.
What does it mean for your mobile app?
From now on, your app users can be identified using the same session for web or mobile, a very convenient way to keep users’ data and offer an optimized user experience. This feature is promising as it’s the first step toward bridging the gap between (mobile) web and native apps and getting the best of both worlds in a single 4D for Mobile application.
How does it work
Technically speaking, when user sessions are enabled, web clients can reuse the same server context from one request to another. You can now get a user session for a user that uses a mobile app from their mobile device.
You can get the Session object from :
- On Mobile App Authentication database method: when the user authenticates
- On Mobile App Action database method: when the user launches an action from his mobile app
- webareas: when the user opens a webarea from his mobile app
For example, here is session data that you can get from the On Mobile App Authentication database method :
And here is what you can get from a web area using 4D tags and the Session object in a mobile app :
Where To Go From Here?
You can already use more web areas in your applications, which gives you more freedom in creating your application. For instance, with our last preset open URL action, you have the convenience of using the powerful 4D backend with native mobile abilities and the advantage of leveraging the fast and consistent UI development offered by 4D tags or whichever framework you choose.
Combining this session management feature with open URL action gives you more than front-end flexibility; this feature opens the doors to real-time data updates on your mobile; think about stock symbols and their values, temperature changes, employees and their geolocation, or even their online/offline status — just to name a few scenarios when data that arrives is updated frequently.
Let us know your thoughts on the 4D forum, and check out the documentation for more details!