Kick out the connected users from the vision client

I'm pretty confident you don't need the gateway message handler at all. You can just broadcast a message from one client to another, can't you? We'll automatically route it through the gateway.

5 Likes

One reason you might want to go through the GW like this and back out is this might be something worth logging in the longer lived gateway logs. Otherwise yea, you can just go client to client.

2 Likes

Gateway Event Script -> Message Handlers

Client Event Script -> Message Handlers

I'm still a bit confused, I get the Id by the moseClick of the table and pass it as a parameter to the Gateway Script and that in turn sends the system.util.exit() to the client Event, looking at the explanation I think I have it right but still I still do not have the result I want.

I have to configure something in the gateway? that is to say, my user role can have these permissions for me to be able to terminate the user session?

1 Like

I think you have to specify the scope to tell it what entities are supposed to get this message

Having said that, as @PGriffith said you don't necessarily need the gateway as the middle man. You can send directly from one client to the other clients. Presumably this table to kill clients is only available to a single or handful admin user(s) and not for everyone.

Send a message from the client/table button push, set the scope argument to 'C' so it goes to the other clients (leverage the clientUserId as well so it only goes to the right one) and then do your exit logic in the client message handler.

Not in the library, but I saw one workaround that involved getting the ClientReqSession object from the GatewayContext. That object supports all methods of java HttpSession including setMaxInactiveInterval() which can be used to force it to time out. There's also an invalidate() method but the implementation I saw didn't call it directly so maybe there's a reason for that.

2 Likes

I finally made it thanks to your comments guys :slight_smile: @PGriffith @bschroeder @bkarabinchak.psi

I did it sending a .sendMessage with the user Id and then directly from the Client event this script and it did it perfectly.

def handleMessage(payload):
    sessionId = payload.get('sessionId')
    if sessionId:
        system.gui.messageBox("You have been kicked by the administrator")
        system.util.exit()
4 Likes