# Websocket on different port?

**URL:** <https://discourse.nodered.org/t/websocket-on-different-port/33768>\
**Category:** General\
**Created:** [5 October 2020 12:53 UTC](https://discourse.nodered.org/t/websocket-on-different-port/33768 "2020-10-05T12:53:03Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![GeneCode](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/genecode/32/29694_2.png) [@GeneCode](https://discourse.nodered.org/u/GeneCode)\
**Post date:** [5 October 2020 12:53 UTC](https://discourse.nodered.org/t/websocket-on-different-port/33768/1 "2020-10-05T12:53:04Z")

</div>

Hi,  
I have a websocket server running on port 60000.

Using the built websocket node, how to set it up to connect to this port?  
Is it possible?

I tried wss://127.0.0.1:60000 but it just disconnected.

I have confirmed my localhost websocket server is working/running by going to browser console and typing ws = new WebSocket("wss://127.0.0.1:60000") and it works.

Thanks.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [5 October 2020 19:54 UTC](https://discourse.nodered.org/t/websocket-on-different-port/33768/2 "2020-10-05T19:54:49Z")

</div>

> [@GeneCode](#):
>
> wss://127.0.0.1:60000

That will connect to a websocket on the same device as the _browser_. Is node-red also running on that same device?

---

<div class="post-metadata">

**Author:** ![GeneCode](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/genecode/32/29694_2.png) [@GeneCode](https://discourse.nodered.org/u/GeneCode)\
**Post date:** [6 October 2020 01:47 UTC](https://discourse.nodered.org/t/websocket-on-different-port/33768/3 "2020-10-06T01:47:43Z")

</div>

Yes.  
Nodered also runs on 127.0.0.1:1880

same device.

---

<div class="post-metadata">

**Author:** ![kuema](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/kuema/32/6542_2.png) [@kuema](https://discourse.nodered.org/u/kuema)\
**Post date:** [6 October 2020 04:25 UTC](https://discourse.nodered.org/t/websocket-on-different-port/33768/4 "2020-10-06T04:25:00Z")

</div>

> [@GeneCode](#):
>
> wss://127.0.0.1:60000

Have you tried `ws://` instead of `wss://`? Otherwise it will connect using transport encryption (SSL/TLS).

---

<div class="post-metadata">

**Author:** ![GeneCode](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/genecode/32/29694_2.png) [@GeneCode](https://discourse.nodered.org/u/GeneCode)\
**Post date:** [6 October 2020 09:04 UTC](https://discourse.nodered.org/t/websocket-on-different-port/33768/5 "2020-10-06T09:04:24Z")

</div>

Yes I have. Still not working. Tried also ws://localhost:60000. still not work

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [6 October 2020 09:29 UTC](https://discourse.nodered.org/t/websocket-on-different-port/33768/6 "2020-10-06T09:29:17Z")

</div>

I think you will need to restart node-red with the logging turned up to see if you can spot what is happening. Otherwise, you will need to start putting some extra log statements into the websocket node to see what is going on.

---

<div class="post-metadata">

**Author:** ![GeneCode](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/genecode/32/29694_2.png) [@GeneCode](https://discourse.nodered.org/u/GeneCode)\
**Post date:** [6 October 2020 15:57 UTC](https://discourse.nodered.org/t/websocket-on-different-port/33768/7 "2020-10-06T15:57:55Z")

</div>

Finally got it to connect. Turns out my websocket needs a wss (secure). And reason it did not connect was that I did not add the TLS settings to it. Even with no certificates, the TLS needs to be added anyhow.

Anyway thanks for your replies guys

---

<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:** [20 October 2020 15:58 UTC](https://discourse.nodered.org/t/websocket-on-different-port/33768/8 "2020-10-20T15:58:02Z")

</div>

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