# Dynamic websocket URL?

**URL:** <https://discourse.nodered.org/t/dynamic-websocket-url/65395>\
**Category:** General\
**Created:** [21 July 2022 00:29 UTC](https://discourse.nodered.org/t/dynamic-websocket-url/65395 "2022-07-21T00:29:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![JetForMe](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jetforme/32/53028_2.png) [@JetForMe](https://discourse.nodered.org/u/JetForMe)\
**Post date:** [21 July 2022 00:29 UTC](https://discourse.nodered.org/t/dynamic-websocket-url/65395/1 "2022-07-21T00:29:17Z")

</div>

I'm trying to set up a websocket connection to the Sense energy monitor API. The URL takes the form `wss://clientrt.sense.com/monitors/%s/realtimefeed?access_token=%s`, and thus is somewhat dynamic. I have a login flow that sets the monitor ID and access token in the flow's context, but I don't see a way to get at those values to create the URL for the websocket client config.

Is there any way to do this?

**UPDATE:** Can I use `{{ }}` in any node property field? Maybe something like `wss://clientrt.sense.com/monitors/{{ global.get("monitorID") }}/realtimefeed`?

**UPDATE 2:**

After some experimentation, I found I can put `{{ msg.payload }}` in a Dashboard Text node value, but not `{{ global.senseRealtime.payload.w }}`. But I _can_ use `senseRealtime.payload.w` as part of a `global.` inject node assignment.

---

<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 September 2022 00:29 UTC](https://discourse.nodered.org/t/dynamic-websocket-url/65395/2 "2022-09-19T00:29:19Z")

</div>

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