How to reuse a Xojo Web Session from another page

Basically, how to do the equivalent to this PHP :

<?php
session_start();
if (!isset($_SESSION['count'])) {
  $_SESSION['count'] = 0;
} else {
  $_SESSION['count']++;
}
?>

If I open a new browser tab in the same browser/computer, both pages will increase Session.count, sharing its value. Both uses the SAME SESSION.

But if a open the same page in another computer, a NEW SESSION starts, with a new count.

PHP session_start() uses a Session.Cookie behind the scenes for this.

Looks like Xojo ALWAYS starts a new Session, and it makes Sessions kind of useless for multi-tabbed views.

I surely don’t know how Xojo Web works with sessions, and couldn’t find the directions using the manual.

Xojo Web will currently always start a new Session for a new tab. There were vaporware promises of Session-restore functions, but I haven’t seen anything actually useful.

You will not be able to achieve cross-tab-sessions, but you can achieve cross-session communication.

1 Like

For me, that means that I must provide my own “kind of” session management using the global App object as the host. Sounds silly, kind of rewriting what should be native, but probably this workaround can be done easily.

Thanks.

1 Like