# Websoket doesn't connect

**URL:** https://discourse.nodered.org/t/websoket-doesnt-connect/82085
**Category:** General
**Created:** [16 October 2023 15:07 UTC](https://discourse.nodered.org/t/websoket-doesnt-connect/82085 "2023-10-16T15:07:48Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![SuperBoss9](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/superboss9/32/23462_2.png) [@SuperBoss9](https://discourse.nodered.org/u/SuperBoss9)
#### Post date: [16 October 2023 15:07 UTC](https://discourse.nodered.org/t/websoket-doesnt-connect/82085/1 "2023-10-16T15:07:48Z")

</div>

Hi everyone!

I'm trying to get some alerting information from my Grafana instance to Node-Red (3.0.2). So I'd like to use Websocket. But something doesn't work as expected:

Config:  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/c/5c2169844f60814a62933109aec892aefbe24709.png)

State:  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/c/3c1bfad4c2fe9aefe3c35235ce22b3379a338e4f.png)

```auto
 curl -i http://192.168.8.158:1880/ws/example
HTTP/1.1 404 Not Found
Access-Control-Allow-Origin: *
X-Powered-By: Express
Content-Security-Policy: default-src 'none'
X-Content-Type-Options: nosniff
Content-Type: text/html; charset=utf-8
Content-Length: 149
Date: Mon, 16 Oct 2023 15:06:58 GMT
Connection: keep-alive
Keep-Alive: timeout=5

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Cannot GET /ws/example</pre>
</body>
</html>

```

192.168.8.158 is the server address

No record in syslog. Guessing what is wrong?

---

<div class="post-metadata">

### Author: ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)
#### Post date: [16 October 2023 16:33 UTC](https://discourse.nodered.org/t/websoket-doesnt-connect/82085/2 "2023-10-16T16:33:58Z")

</div>

> [@SuperBoss9](#):
>
> `curl -i http://192.168.8.158:1880/ws/example`

You are trying to connect to a websocket using curl, while you need a websocket client in order to connect.  
It is possible with curl to perform a websocket request, but it is a bit more complicated than this.

---

<div class="post-metadata">

### Author: ![SuperBoss9](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/superboss9/32/23462_2.png) [@SuperBoss9](https://discourse.nodered.org/u/SuperBoss9)
#### Post date: [16 October 2023 16:52 UTC](https://discourse.nodered.org/t/websoket-doesnt-connect/82085/3 "2023-10-16T16:52:35Z")

</div>

> [@SuperBoss9](#):
>
> curl -i [http://192.168.8.158:1880/ws/example](http://192.168.8.158:1880/ws/example)

Yes, you are correct.  
That helped

```auto
wscat -c "ws://192.168.8.158:1880/ws/example"
Connected (press CTRL+C to quit)
> Hello
< Hello

```

---

<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: [16 October 2023 16:58 UTC](https://discourse.nodered.org/t/websoket-doesnt-connect/82085/4 "2023-10-16T16:58:15Z")

</div>

You can, of course, just use a separate flow with a ws in node! 😉

---

<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: [30 October 2023 16:59 UTC](https://discourse.nodered.org/t/websoket-doesnt-connect/82085/5 "2023-10-30T16:59:07Z")

</div>

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