# Close Websocket Connections to specific Sessions

**URL:** <https://discourse.nodered.org/t/close-websocket-connections-to-specific-sessions/94030>\
**Category:** General\
**Tags:** websocket\
**Created:** [19 December 2024 16:48 UTC](https://discourse.nodered.org/t/close-websocket-connections-to-specific-sessions/94030 "2024-12-19T16:48:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![HrKnuddel\_2015](https://avatars.discourse-cdn.com/v4/letter/h/e480ec/32.png) [@HrKnuddel\_2015](https://discourse.nodered.org/u/HrKnuddel_2015)\
**Post date:** [19 December 2024 16:48 UTC](https://discourse.nodered.org/t/close-websocket-connections-to-specific-sessions/94030/1 "2024-12-19T16:48:33Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [19 March 2025 16:49 UTC](https://discourse.nodered.org/t/close-websocket-connections-to-specific-sessions/94030/2 "2025-03-19T16:49:11Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
