Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X
Hi community!
Is there somebody who knows if there is a possibility to execute a service, when a session has started or stopped? And is there a variable where I can see the number of currently opened Mashups/Sessions?
My problem is as followed:
I have a webcamscream running on an ems which can be started oder stopped by a service (stopStream, startStream) in TWX. My goal is that the webcam is just active when a user has the mashup opened.
I didn't found a solution on google...unfortunately.
Hoping for help!
Chris
Solved! Go to Solution.
Regarding Session started / ended: The "SecurityMonitor" has events you can subscribe to
But this is specific to the whole platform - not to the mashup you'd like to have. I am also not sure, if a session timeout creates a Logout event (e.g. user was inactive for 30 minutes). So just as a FYI.
My quick idea/hack for your issue would be
- to create a thing with e.g. a datetime property.
- In the mashup you update the property in an interval. So every user having the mashup open will write to this property.
- You also create a scheduler, which runs e.g. every minute and checks for the property value. If the property value is older than x - you assume no one uses the mashup so you close the stream (if open). if it was written to previously you start it (if not already started).
Within the Server you can get 'active sessions' or 'users logged in'
That may or may not be enough for you to determine if you want to activate or deactivate something
As for a 'session start' you could use the 'FormLogin' and direct it to a mashup that uses a Mashup load.
There is no way to have an event to the server on session end, unless users click on some logout button.
since session end means you can't contact the server anymore from the client without authentication.
Regarding Session started / ended: The "SecurityMonitor" has events you can subscribe to
But this is specific to the whole platform - not to the mashup you'd like to have. I am also not sure, if a session timeout creates a Logout event (e.g. user was inactive for 30 minutes). So just as a FYI.
My quick idea/hack for your issue would be
- to create a thing with e.g. a datetime property.
- In the mashup you update the property in an interval. So every user having the mashup open will write to this property.
- You also create a scheduler, which runs e.g. every minute and checks for the property value. If the property value is older than x - you assume no one uses the mashup so you close the stream (if open). if it was written to previously you start it (if not already started).
Thanks a lot! I will try that. It feels a little bit bungled, but it should work.