cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X

Mashup: Execute Service when Session Started and Stopped

cjjaeckson
10-Marble

Mashup: Execute Service when Session Started and Stopped

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

ACCEPTED SOLUTION

Accepted Solutions

Regarding Session started / ended: The "SecurityMonitor" has events you can subscribe to

nmutter_0-1669380748137.png

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).

View solution in original post

3 REPLIES 3
PaiChung
22-Sapphire I
(To:cjjaeckson)

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

nmutter_0-1669380748137.png

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.

Announcements


Top Tags