# Dashboard template script websocket

**URL:** https://discourse.nodered.org/t/dashboard-template-script-websocket/8061
**Category:** Dashboard
**Created:** [17 February 2019 05:27 UTC](https://discourse.nodered.org/t/dashboard-template-script-websocket/8061 "2019-02-17T05:27:06Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![fabnavigator](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/fabnavigator/32/5403_2.png) [@fabnavigator](https://discourse.nodered.org/u/fabnavigator)
#### Post date: [17 February 2019 05:27 UTC](https://discourse.nodered.org/t/dashboard-template-script-websocket/8061/1 "2019-02-17T05:27:06Z")

</div>

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

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

```

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

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [17 February 2019 09:39 UTC](https://discourse.nodered.org/t/dashboard-template-script-websocket/8061/2 "2019-02-17T09:39:55Z")

</div>

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

---

<div class="post-metadata">

### Author: ![fabnavigator](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/fabnavigator/32/5403_2.png) [@fabnavigator](https://discourse.nodered.org/u/fabnavigator)
#### Post date: [17 February 2019 11:52 UTC](https://discourse.nodered.org/t/dashboard-template-script-websocket/8061/3 "2019-02-17T11:52:00Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [17 February 2019 15:23 UTC](https://discourse.nodered.org/t/dashboard-template-script-websocket/8061/4 "2019-02-17T15:23:38Z")

</div>

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](https://community.bose.com/t5/SoundTouch-Archive/Anybody-has-websocket-working-with-Bose-Soundtouch-10/td-p/20187)

---

<div class="post-metadata">

### Author: ![fabnavigator](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/fabnavigator/32/5403_2.png) [@fabnavigator](https://discourse.nodered.org/u/fabnavigator)
#### Post date: [17 February 2019 16:37 UTC](https://discourse.nodered.org/t/dashboard-template-script-websocket/8061/5 "2019-02-17T16:37:32Z")

</div>

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.
