Dashboard template script websocket

#1

I would like to create a script in a dashboard template node that creates a websocket. Like below:

<script>
...
websocket = new WebSocket(wsUri, protocol);
...
</script>

I think that I probably need to install something to get this to work.

#2

you shouldn't need to as it's standard HTML5.

#3

Thank you. Hearing that, I did some more digging. Saw this on the console:Uncaught DOMException: Failed to construct 'WebSocket': An insecure WebSocket connection may not be initiated from a page loaded over HTTPS.
Looks like I'm SOL unless you know some magical workaround for this. I'm using HTTPS for NR, and am trying to open a Bose Soundtouch websocket, which is over HTTP only. Any thoughts?

#4

Well that would be a big security no-no so yes you are slight stuck if you want to do it direct. You could maybe write a small script that talks to the Bose then passes that out locally through something like MQTT or some such. Eg a separate process like these https://community.bose.com/t5/SoundTouch-Archive/Anybody-has-websocket-working-with-Bose-Soundtouch-10/td-p/20187

1 Like
#5

Thank you for the information, and the link. I might put this on the back burner for now though. I've developed a NR based Soundtouch controller flow that works very well, even w/o the websocket feedback part of the equation.