Close Websocket Connections to specific Sessions

HrKnuddel_2015
Thu, 19 Dec 2024 16:48:33 +0000
General

I have a Websocket server setup in my Node-Red and for that server you need to authenticate (It's a system to relay Messages from another source). From the beginning we wanted to automatically disconnect every Session that doesn't authenticate to keep the connections clean. But recently Node-Red started showing me Connections that got closed from the client side but still connected on the server Side (Node-Red shows me "connected 2" under the Websocket Server nodes even though there should only be one) Because of how the Server is setup I can see that these are older connections from the (same) client system. So now i want even more a way to close connections to specific Sessions to keep it clean. I search already in multiple places but either it was about disconnecting where Node-Red is the client or it was not what i wanted.

TL;DR
Is there any way to disconnect a Session (external) from a Websocket Server (Node-Red)

The Reason why I want this is because Node-Red automatically cleans all the info when there is nobody connected to the Websocket server so there is no idle stress on the server when it is not used.

2 posts - 2 participants