# How to create a server for websocket node

**URL:** <https://discourse.nodered.org/t/how-to-create-a-server-for-websocket-node/27968>\
**Category:** Dashboard\
**Created:** [8 June 2020 03:09 UTC](https://discourse.nodered.org/t/how-to-create-a-server-for-websocket-node/27968 "2020-06-08T03:09:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shimu](https://avatars.discourse-cdn.com/v4/letter/s/8baadc/32.png) [@Shimu](https://discourse.nodered.org/u/Shimu)\
**Post date:** [8 June 2020 03:09 UTC](https://discourse.nodered.org/t/how-to-create-a-server-for-websocket-node/27968/1 "2020-06-08T03:09:40Z")

</div>

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/1/0174f9d7de1abea86f2c0e8ff3019a6877ef7d2c.png)

---

<div class="post-metadata">

**Author:** ![Nxito](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nxito/32/88293_2.png) [@Nxito](https://discourse.nodered.org/u/Nxito)\
**Post date:** [8 June 2020 07:35 UTC](https://discourse.nodered.org/t/how-to-create-a-server-for-websocket-node/27968/2 "2020-06-08T07:35:58Z")

</div>

hi shimu, u must to explain your problem better  
i think u mean this

```auto
[{"id":"8a2b77d8.7c8e68","type":"http response","z":"c4fd988a.ab0db8","name":"","statusCode":"","headers":{},"x":430,"y":580,"wires":[]},{"id":"fb94312c.e079e","type":"websocket in","z":"c4fd988a.ab0db8","name":"","server":"7070206c.62f4","client":"","x":100,"y":620,"wires":[["b275a5e.3e23e58"]]},{"id":"14b00429.d65e3c","type":"http in","z":"c4fd988a.ab0db8","name":"","url":"url","method":"get","upload":false,"swaggerDoc":"","x":100,"y":580,"wires":[["dba11beb.2b5508"]]},{"id":"dba11beb.2b5508","type":"template","z":"c4fd988a.ab0db8","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<div>Web works</div>\n<script>var ws = new WebSocket(\"ws://localhost:1881/ws/url\");\nvar message={}\n\nws.onopen = function() {\n message = {\n 'payload': 'Client connected'\n };\n ws.send(JSON.stringify(message));\n};</script>","output":"str","x":280,"y":580,"wires":[["8a2b77d8.7c8e68"]]},{"id":"b275a5e.3e23e58","type":"debug","z":"c4fd988a.ab0db8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":330,"y":620,"wires":[]},{"id":"7070206c.62f4","type":"websocket-listener","z":"","path":"/ws/url","wholemsg":"false"}]

```

---

<div class="post-metadata">

**Author:** ![Shimu](https://avatars.discourse-cdn.com/v4/letter/s/8baadc/32.png) [@Shimu](https://discourse.nodered.org/u/Shimu)\
**Post date:** [8 June 2020 07:53 UTC](https://discourse.nodered.org/t/how-to-create-a-server-for-websocket-node/27968/3 "2020-06-08T07:53:53Z")

</div>

Thank you very much. It's enlightening. I want the kind of page data that node controls other ports in real time. Node Red's WebSocket is equivalent to pushing MSG, and other port pages receive the MSG pushed by WebSocket.

---

<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:** [8 July 2020 07:53 UTC](https://discourse.nodered.org/t/how-to-create-a-server-for-websocket-node/27968/4 "2020-07-08T07:53:57Z")

</div>

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