Hi folks,
I would like to have some sort of dashboard webpage in my web app
a simple listbox of all opened sessions and their user names
the user name is a property of the session object.
I can get all the sessions with : (LR excerpt)
For Each activeSession As WebSession In App.Sessions
ListBox1.AddRow(activeSession.CurrentPage.Name)
Next
but can I access the properties I added to my session object ?
it is not possible to subclass the Session object.
how can you do that ?
I’m not so sure that you can just do this, since this probably only works on the main thread. In web you must watchout since lot’s of stuff seems to be threaded by xojo. @Greg_O_Lone can maybe explain what’s threaded?
It’s not a question of whether something is threaded or not, but whether or not there’s a session attached to the current thread.
If you’re curious about whether some code is running in a thread, you can look at App.CurrentThread. That’ll be a easier than me making a list, but I think you’ll find that usually things are, with the exception of things like socket and Timer events.
If this were me, I would be putting a Timer or Thread somewhere that’s initialized from App which periodically grabs this info. You can cycle through the sessions, creating and destroying WebSessionContexts as you go, just so you can pull the stats you need and store them in a global JSONItem which is retrieved from your dashboard periodically.