Repository navigation
Only connect websocket client if need to - #5533
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR changes the websocket client config node behavior so it only establishes the underlying outbound connection when there is an active node that actually uses it, addressing Issue #5506 (client config nodes connecting even when dependent flows are disabled).
Changes:
- Stop auto-connecting websocket client config nodes on creation; defer connection until a consumer node exists.
- Trigger client connection when the first websocket in node registers, and when a websocket out node is created.
- Update existing websocket-client tests to include a consumer node so connection-oriented assertions still run.
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
packages/node_modules/@node-red/nodes/core/network/22-websocket.js |
Defers websocket client connection and adds “connect-on-first-consumer” logic. |
test/nodes/core/network/22-websocket_spec.js |
Adjusts websocket-client tests to ensure a consumer node exists so a connection is initiated. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
3 of 6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
to address Issue #5506
Proposed changes
This PR enhances the web socket node to only connect (when in client mode) the underlying connection if there is actually a node that demands it. IE If you disable all the client nodes on the desktop the underlying config node will not create a connection.
Checklist
npm run testto verify the unit tests pass