# Is there a way to set connections as properties on subflows

**URL:** https://discourse.nodered.org/t/is-there-a-way-to-set-connections-as-properties-on-subflows/57664
**Category:** General
**Created:** [2 February 2022 15:50 UTC](https://discourse.nodered.org/t/is-there-a-way-to-set-connections-as-properties-on-subflows/57664 "2022-02-02T15:50:19Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![cwalter5](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cwalter5/32/55639_2.png) [@cwalter5](https://discourse.nodered.org/u/cwalter5)
#### Post date: [2 February 2022 15:50 UTC](https://discourse.nodered.org/t/is-there-a-way-to-set-connections-as-properties-on-subflows/57664/1 "2022-02-02T15:50:19Z")

</div>

Hi, I was hoping to create a subflow which could read data from a websocket and send an acknowledgement message back before outputting to the main flow. This appears to be possible but, the whole reason I'd like to put this into a subflow is so that I could create multiple instances of this subflow each connecting to a different websocket. Unfortunately, it appears that the websocket node has to be directly aware of the connection rather than being able to do any form of lookup.

Is there a way around this limitation or am I stuck copying and pasting any logic that is tied directly to the processing of a websocket connection? Would it be possible to extend NodeRed to enable said capabilities? And if so, where should I turn my attention next if I was to contribute them to the project?

Thanks

---

<div class="post-metadata">

### Author: ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)
#### Post date: [2 February 2022 15:54 UTC](https://discourse.nodered.org/t/is-there-a-way-to-set-connections-as-properties-on-subflows/57664/2 "2022-02-02T15:54:22Z")

</div>

Hi @cwalter5

You should be able to use Subflow Properties to do this.

1. In the Websocket node inside the subflow, set the URL to connect to as `${WebSocket_URL}`
2. In the Subflow properties dialog, add a new Environment Variable, call it `WebSocket_URL`.

You should then find each instance of the subflow has a `WebSocket_URL` as a field you can config in its edit dialog.

All being well, that will let you customise the WebSocket endpoint for each subflow instance.

---

<div class="post-metadata">

### Author: ![cwalter5](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cwalter5/32/55639_2.png) [@cwalter5](https://discourse.nodered.org/u/cwalter5)
#### Post date: [2 February 2022 17:50 UTC](https://discourse.nodered.org/t/is-there-a-way-to-set-connections-as-properties-on-subflows/57664/3 "2022-02-02T17:50:22Z")

</div>

Thanks for the quick response. I'll get back to you once I get a chance to test it out.

---

<div class="post-metadata">

### Author: ![cwalter5](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cwalter5/32/55639_2.png) [@cwalter5](https://discourse.nodered.org/u/cwalter5)
#### Post date: [3 February 2022 20:20 UTC](https://discourse.nodered.org/t/is-there-a-way-to-set-connections-as-properties-on-subflows/57664/4 "2022-02-03T20:20:30Z")

</div>

I got it working .Thank you for your help.

---

<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: [17 February 2022 20:21 UTC](https://discourse.nodered.org/t/is-there-a-way-to-set-connections-as-properties-on-subflows/57664/5 "2022-02-17T20:21:10Z")

</div>

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