Vision or Perspective list of running clients and terminate

Using v8.0.16 vision or perspective…

Is there a way to list all clients in a table either in vision or perspective and then terminate via script? This can be done in the webpage, but was wondering if this is possible in vision or perspective.

sessions = system.perspective.getSessionInfo()
for sess in session:
    system.perspective.closeSession(sess.id)

Thanks, not sure how I missed that. Is there a way to close for vision as well, I didn’t see that?

I’m not as familiar with Vision, but I do see a way to do something similar.
You would need to perform the following steps:

  1. When desired, trigger an event. This Event should invoke something like this: systemutil.sendMessage(project='MyProject', messageHandler='VISIONSHUTDOWN', payload={}, scope='C')
  2. In the Designer, switch to the Vision context and configure a Client Event Message Handler with “VISIONSHUTDOWN” as the key, and for the script invoke system.security.logout().

Or system.util.exit(), to be more directly analogous. Note that Vision has much less of a guarantee of success. The client has to be ‘alive’ to receive the message, not so busy that it handles it, and choose to exit.

Technically, Perspective has the same problem, in a way - closing the backend session doesn’t actually close the tab/app/whatever on the user’s device - but because Perspective sessions don’t work without the backend, it’s a lot more obvious.

1 Like

Thanks guys.