# Kick out the connected users from the vision client

**URL:** <https://forum.inductiveautomation.com/t/kick-out-the-connected-users-from-the-vision-client/81239>\
**Category:** Ignition\
**Tags:** ignition81, vision\
**Created:** [October 31, 2023, 4:10pm UTC](https://forum.inductiveautomation.com/t/kick-out-the-connected-users-from-the-vision-client/81239 "2023-10-31T16:10:30Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Miguel\_Cimildoro](https://avatars.discourse-cdn.com/v4/letter/m/53a042/32.png) [@Miguel\_Cimildoro](https://forum.inductiveautomation.com/u/Miguel_Cimildoro)\
**Post date:** [October 31, 2023, 4:10pm UTC](https://forum.inductiveautomation.com/t/kick-out-the-connected-users-from-the-vision-client/81239/1 "2023-10-31T16:10:31Z")

</div>

good afternoon and happy halloween 🧙 🎃,

I have to say, is there any way to terminate the process of a Vision client? i.e. to see the list of those who are connected from the vision and with a button to kick them out?

---

<div class="post-metadata">

**Author:** ![Matrix\_Engineering](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/matrix_engineering/32/19781_2.png) [@Matrix\_Engineering](https://forum.inductiveautomation.com/u/Matrix_Engineering)\
**Post date:** [October 31, 2023, 4:15pm UTC](https://forum.inductiveautomation.com/t/kick-out-the-connected-users-from-the-vision-client/81239/2 "2023-10-31T16:15:56Z")

</div>

Yes, go to the gateway webpage/Status/Vision clients, there you will see a list of them an an option to terminate

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [October 31, 2023, 4:17pm UTC](https://forum.inductiveautomation.com/t/kick-out-the-connected-users-from-the-vision-client/81239/3 "2023-10-31T16:17:21Z")

</div>

If you want to have some kind of "management" screen, you can set up client message handlers that call `system.util.exit`, and then use [`system.util.sendMessage`](https://docs.inductiveautomation.com/display/DOC81/system.util.sendMessage) to broadcast a message to those other clients _requesting_ that they close.

---

<div class="post-metadata">

**Author:** ![Miguel\_Cimildoro](https://avatars.discourse-cdn.com/v4/letter/m/53a042/32.png) [@Miguel\_Cimildoro](https://forum.inductiveautomation.com/u/Miguel_Cimildoro)\
**Post date:** [October 31, 2023, 4:17pm UTC](https://forum.inductiveautomation.com/t/kick-out-the-connected-users-from-the-vision-client/81239/4 "2023-10-31T16:17:57Z")

</div>

that's exactly what I want to do but with a button from the vision/designer.

---

<div class="post-metadata">

**Author:** ![Miguel\_Cimildoro](https://avatars.discourse-cdn.com/v4/letter/m/53a042/32.png) [@Miguel\_Cimildoro](https://forum.inductiveautomation.com/u/Miguel_Cimildoro)\
**Post date:** [October 31, 2023, 4:22pm UTC](https://forum.inductiveautomation.com/t/kick-out-the-connected-users-from-the-vision-client/81239/5 "2023-10-31T16:22:50Z")

</div>

Should I put as a parameter the user's name? e.g. system.util.exit('Miguel')?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [October 31, 2023, 4:47pm UTC](https://forum.inductiveautomation.com/t/kick-out-the-connected-users-from-the-vision-client/81239/6 "2023-10-31T16:47:18Z")

</div>

No. You need to go from your local client where this window resides to the other client. You do that using `system.util.sendMessage`\[1\] to broadcast out, and a client message handler\[2\] to receive that broadcast. `system.util.exit`\[3\] takes only one argument, a 'force' option to bypass a shutdown intercept script that might exist on the client.

You can use `system.util.getSessionInfo`\[4\] to get the list of possible client session IDs to broadcast your message to, to pass to `system.util.sendMessage`.

* * *

1. [system.util.sendMessage - Ignition User Manual 8.1 - Ignition Documentation](https://docs.inductiveautomation.com/display/DOC81/system.util.sendMessage) 

2. [Client Event Scripts - Ignition User Manual 8.1 - Ignition Documentation](https://docs.inductiveautomation.com/display/DOC81/Client+Event+Scripts#ClientEventScripts-MessageScripts) 

3. [system.util.exit - Ignition User Manual 8.1 - Ignition Documentation](https://docs.inductiveautomation.com/display/DOC81/system.util.exit) 

4. [system.util.getSessionInfo - Ignition User Manual 8.1 - Ignition Documentation](https://docs.inductiveautomation.com/display/DOC81/system.util.getSessionInfo)

---

<div class="post-metadata">

**Author:** ![Miguel\_Cimildoro](https://avatars.discourse-cdn.com/v4/letter/m/53a042/32.png) [@Miguel\_Cimildoro](https://forum.inductiveautomation.com/u/Miguel_Cimildoro)\
**Post date:** [November 2, 2023, 4:15pm UTC](https://forum.inductiveautomation.com/t/kick-out-the-connected-users-from-the-vision-client/81239/7 "2023-11-02T16:15:53Z")

</div>

ok I think I have it clear, but first I would like to see first the list of connected users in a table, could I do that using the power Table component?

then having that list in the power table for example, I would like to add a button to unlogin a user that is in the Vision, can I do it with the Table or better with power table?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [November 2, 2023, 4:30pm UTC](https://forum.inductiveautomation.com/t/kick-out-the-connected-users-from-the-vision-client/81239/8 "2023-11-02T16:30:01Z")

</div>

I would use a template repeater, in dataset mode: [Using the Template Repeater - Ignition User Manual 8.1 - Ignition Documentation](https://docs.inductiveautomation.com/display/DOC81/Using+the+Template+Repeater#UsingtheTemplateRepeater-UsingtheTemplateRepeaterwithDatasetMode)

Make a simple template with parameters corresponding the columns returned by `system.util.getSessionInfo`. Add a button that broadcasts your "kill yourself" message using the `clientId` parameter.

---

<div class="post-metadata">

**Author:** ![Miguel\_Cimildoro](https://avatars.discourse-cdn.com/v4/letter/m/53a042/32.png) [@Miguel\_Cimildoro](https://forum.inductiveautomation.com/u/Miguel_Cimildoro)\
**Post date:** [November 3, 2023, 9:12am UTC](https://forum.inductiveautomation.com/t/kick-out-the-connected-users-from-the-vision-client/81239/9 "2023-11-03T09:12:29Z")

</div>

sorry for the late reply, in this case I have already made some progress making a script initialized in a Power Table, I get the result of the users connected in the Vision, now I just need to make a Terminate button on the user id obtained.

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/3/233e1d15db89e6f9bfdb1530e87838380dee6076.png)

using this script:

```auto
	sessionInfoList = system.util.getSessionInfo()
	
	# Crear una lista para almacenar los datos de los usuarios activos con el cuarto parámetro en True
	usuariosActivos = []
	
	# Iterar a través de las sublistas y obtener los datos deseados (primer y segundo campo)
	for sublista in sessionInfoList:
	    # Obtener el primer y cuarto campo (índices 0 y 3)
	    primer_campo = sublista[0]
	    cuarto_campo = sublista[3]
	
	    # Verificar si el cuarto campo es True antes de agregarlo a la lista
	    if cuarto_campo == False:
	        usuariosActivos.append([primer_campo])
	

	table = self

	# Crear un dataset con las columnas adecuadas
	header = ['Connected in vision']
	data = [] # Aquí almacenaremos los datos
	
	for usuario in usuariosActivos:
	    data.append(usuario)
	
	# Establecer el dataset en la tabla
	table.data = system.dataset.toDataSet(header, data)

```

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [November 3, 2023, 2:40pm UTC](https://forum.inductiveautomation.com/t/kick-out-the-connected-users-from-the-vision-client/81239/10 "2023-11-03T14:40:41Z")

</div>

Adding a clickable button to the power table is a lot harder than setting up a template repeater. You're welcome to search out some techniques on how to do it here on the forums.

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [November 3, 2023, 2:55pm UTC](https://forum.inductiveautomation.com/t/kick-out-the-connected-users-from-the-vision-client/81239/11 "2023-11-03T14:55:55Z")

</div>

Maybe have double clicking a row open a popup as confirmation "Disconnect user X?" and there have the button that has the logic to send messages to really disconnect them in lieu of a button in the table.

---

<div class="post-metadata">

**Author:** ![Miguel\_Cimildoro](https://avatars.discourse-cdn.com/v4/letter/m/53a042/32.png) [@Miguel\_Cimildoro](https://forum.inductiveautomation.com/u/Miguel_Cimildoro)\
**Post date:** [November 6, 2023, 8:32am UTC](https://forum.inductiveautomation.com/t/kick-out-the-connected-users-from-the-vision-client/81239/12 "2023-11-06T08:32:31Z")

</div>

ok, I see your point... since I have never used a Template repater, I will have to do my own research on it.

---

<div class="post-metadata">

**Author:** ![Miguel\_Cimildoro](https://avatars.discourse-cdn.com/v4/letter/m/53a042/32.png) [@Miguel\_Cimildoro](https://forum.inductiveautomation.com/u/Miguel_Cimildoro)\
**Post date:** [November 7, 2023, 2:31pm UTC](https://forum.inductiveautomation.com/t/kick-out-the-connected-users-from-the-vision-client/81239/14 "2023-11-07T14:31:58Z")

</div>

Hi Paul, I'm kind of close to finishing this task.

So far I get the list of users connected in Vision by a Templeate Repeater, just as you mentioned above. In addition I added a "terminate" column precisely to terminate the session of that user by ID.

all ok for now..

What I have not been able to do and is already giving me a bit of a headache hehe. is to use the system.util.sendMessage method to end the user's session.

this is the onClick code of the power table

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/c/bc2af70df74d8acbc2722801bdebd42a17c3396e.png)

and this is the Gateway event where I will use the system.util.sendMessage to end the session.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/8/78f7e8996aae19c487c47755b348a4a566fb443e.png)

Am I using the wrong method? I would really appreciate your opinion on this.

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [November 7, 2023, 2:49pm UTC](https://forum.inductiveautomation.com/t/kick-out-the-connected-users-from-the-vision-client/81239/15 "2023-11-07T14:49:56Z")

</div>

Where are you getting `system.util.closeSession` from? I don't see that anywhere here [system.util - Ignition User Manual 8.1 - Ignition Documentation](https://docs.inductiveautomation.com/display/DOC81/system.util)

Are you seeing anything in your gateway logs? Your client sending a message looks fine. I imagine the issue may be on your gateway message handling side. See if any errors are coming up there when you try to run it. Add some logging if you want to check the values at different steps.

EDIT: Look at what message handler you are sending to - `terminateUser` but you named the message handler `terminateSession` - these should match.

---

<div class="post-metadata">

**Author:** ![Miguel\_Cimildoro](https://avatars.discourse-cdn.com/v4/letter/m/53a042/32.png) [@Miguel\_Cimildoro](https://forum.inductiveautomation.com/u/Miguel_Cimildoro)\
**Post date:** [November 7, 2023, 3:07pm UTC](https://forum.inductiveautomation.com/t/kick-out-the-connected-users-from-the-vision-client/81239/16 "2023-11-07T15:07:02Z")

</div>

> [@bkarabinchak.psi](#):
>
> Where are you getting `system.util.closeSession` from? I don't see that anywhere here [system.util - Ignition User Manual 8.1 - Ignition Documentation](https://docs.inductiveautomation.com/display/DOC81/system.util)
> 
> Are you seeing anything in your gateway logs? Your client sending a message looks fine. I imagine the issue may be on your gateway message handling side. See if any errors are coming up there when you try to run it. Add some logging if you want to check the values at different steps.

Uploading: image.png…

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/0/d0aed41cb1f4535bc5d54aea34039779b3e615b5.png)

when I click on the Terminate button it prints the ID message correctly

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/2/d20b5d260f7b8285a036607dc92afd8d40fa6adc.png)

is system.util.exit, not closeSession what i using

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [November 7, 2023, 3:14pm UTC](https://forum.inductiveautomation.com/t/kick-out-the-connected-users-from-the-vision-client/81239/17 "2023-11-07T15:14:32Z")

</div>

You are calling system.util.exit from your gateway scope but it only works in the vision scope - [system.util.exit - Ignition User Manual 8.1 - Ignition Documentation](https://docs.inductiveautomation.com/display/DOC81/system.util.exit)

It is not doing anything in your gateway or throwing an error because the function is not available. It also does not take an argument of clientId, just a boolean about whether or not to force exit (the vision client it was called on).

If you want to go the Client -\> Gateway message route, I think from the gateway, it should be sending another message to the appropriate client (you have the id so you can do it with that and the `clientSessionId` argument). You'll need a client message handler to handle this message, and there is where you would call `system.util.exit()`.

Perhaps there's a different command in the Ignition library you can use from the gateway to kill a client remotely, but I don't see one at least under `system.util`. Maybe someone else knows.

---

<div class="post-metadata">

**Author:** ![bschroeder](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bschroeder/32/13260_2.png) [@bschroeder](https://forum.inductiveautomation.com/u/bschroeder)\
**Post date:** [November 7, 2023, 3:29pm UTC](https://forum.inductiveautomation.com/t/kick-out-the-connected-users-from-the-vision-client/81239/18 "2023-11-07T15:29:37Z")

</div>

Client message is the way I've done this in the past. When the user clicks exit send a message to the proper hostname and then on the client side execute the system.util.exit().

Also OP... consider adding a secret UUID or something in the payload when you send the message and check on the client side that the UUID is correct. Just a simple test to make sure that the message came from the gateway and not something else rogue.

Edit: I'll see if I can dig this up from the customer I did it for.

---

<div class="post-metadata">

**Author:** ![Miguel\_Cimildoro](https://avatars.discourse-cdn.com/v4/letter/m/53a042/32.png) [@Miguel\_Cimildoro](https://forum.inductiveautomation.com/u/Miguel_Cimildoro)\
**Post date:** [November 7, 2023, 3:43pm UTC](https://forum.inductiveautomation.com/t/kick-out-the-connected-users-from-the-vision-client/81239/19 "2023-11-07T15:43:05Z")

</div>

mm ok, putting a little bit in context of what I have understood:

1. Vision scope: system.util.exit works only within the scope of the Vision client, not within the scope of the server (gateway). This means that you should directly close a Vision client from a script running on the server.

2. Argument of system.util.exit: This method only takes a boolean argument indicating whether to force close the Vision client. It does not take a client ID as an argument.

3. Client-Gateway-Client Communication:

in conclusion:

```auto
# This code is executed when the user clicks on a row to end the session.
id = self.data.getValueAt(row, 'Id')
system.util.sendMessage(project='BALEN', messageHandler='sendShutdownCommand', payload={'sessionId': id})`

```

```auto
# This is an example of how the message handler in the gateway could look like
def sendShutdownCommand(payload):
    sessionId = payload['sessionId']
    system.util.sendMessage(project='BALEN', messageHandler='shutdownClient', payload={}, clientSessionId=sessionId)

```

```auto
# This is an example of what the message handler could look like in the client que debe cerrar sesión
def shutdownClient(payload):
    system.util.exit(force=True)

```

---

<div class="post-metadata">

**Author:** ![bschroeder](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bschroeder/32/13260_2.png) [@bschroeder](https://forum.inductiveautomation.com/u/bschroeder)\
**Post date:** [November 7, 2023, 3:46pm UTC](https://forum.inductiveautomation.com/t/kick-out-the-connected-users-from-the-vision-client/81239/20 "2023-11-07T15:46:36Z")

</div>

That looks pretty close to what I've done in the past.

The only other thing that I mentioned above, is to add a secret or something to the payload that comes from the gateway and check it on the client to make sure that the message came from the gateway directly.

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [November 7, 2023, 3:48pm UTC](https://forum.inductiveautomation.com/t/kick-out-the-connected-users-from-the-vision-client/81239/21 "2023-11-07T15:48:29Z")

</div>

Looks about right to me! The documentation tells you what scopes any given function are available, definitely something to get used to looking at -  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/5/a518366093f841d9d0122074eceba6c98af3ea6f.png)

[Next page](https://forum.inductiveautomation.com/t/kick-out-the-connected-users-from-the-vision-client/81239.md?page=2)
