Websocket node - dynamic URL

498 views
Skip to first unread message

Greg Gorman

unread,
Aug 11, 2016, 3:57:55 PM8/11/16
to Node-RED
Hi everyone,
I'm working a flow that communicates with the Centralite Jilia.io platform. They require an access token on every URL that expires hourly - ugh...

One of the cool things about their home automation devices is that you can connect to a websocket to monitor them in real time. So, I did that, with a hard-coded access token to prove that I could do it.

My quesiton is though, if I set up a global variable with the access token in it, and a way to refresh it either by exception or every xx minutes, how do I get the Websocket listener node's URL to pick up the global variable? I tried this, but doesn't seem to work...any suggestions?

wss://api.jilia.io/v1/servers/c41da28a-e727-4dea-986b-a7d1033b7b54/events?topic=occupancy%2Fa5185dbc-82b7-47dd-b175-970606313490%2Fmotion&access_token={{{global.get("JiliaOauth")}}}

Please excuse my newbie-ness....

/Greg

Dave C-J

unread,
Aug 11, 2016, 4:54:32 PM8/11/16
to node...@googlegroups.com
you need to "get" it into a msg. property in a previous change node (or function node if you already have one) - then pass in it in to the ws node... -  the mustache syntax only works on properties of the msg object.  so {{token}} if you used msg.token

Greg Gorman

unread,
Aug 11, 2016, 5:13:06 PM8/11/16
to node...@googlegroups.com

Thanks for the hint Dave.  Does a ws-in node accept an incoming flow so I can do that? Wasn't obvious to me but I'll play with it some more. 

/Greg


On Aug 11, 2016 3:54 PM, "Dave C-J" <dce...@gmail.com> wrote:
you need to "get" it into a msg. property in a previous change node (or function node if you already have one) - then pass in it in to the ws node... -  the mustache syntax only works on properties of the msg object.  so {{token}} if you used msg.token

--
http://nodered.org
 
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to a topic in the Google Groups "Node-RED" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/node-red/tL1QkmynheU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to node-red+unsubscribe@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
For more options, visit https://groups.google.com/d/optout.

Dave C-J

unread,
Aug 11, 2016, 5:19:33 PM8/11/16
to node...@googlegroups.com
ahhhh - no sorry I'm being dense... you can't set it dynamically on the websocket node...
(for some reason I read ws and thought http request...)
apologies for getting your hopes up.
Reply all
Reply to author
Forward
0 new messages