# Can´t connect to Node Red as Client

**URL:** <https://discourse.nodered.org/t/can-t-connect-to-node-red-as-client/49386>\
**Category:** General\
**Created:** [5 August 2021 15:47 UTC](https://discourse.nodered.org/t/can-t-connect-to-node-red-as-client/49386 "2021-08-05T15:47:14Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![Baluba](https://avatars.discourse-cdn.com/v4/letter/b/838e76/32.png) [@Baluba](https://discourse.nodered.org/u/Baluba)\
**Post date:** [5 August 2021 15:47 UTC](https://discourse.nodered.org/t/can-t-connect-to-node-red-as-client/49386/1 "2021-08-05T15:47:14Z")

</div>

Hello everyone,  
i created a little Raspberry Pi Node-Red Setup according to some videos and the basic steps from the webpage. Right now everything seems fine. I Installed Mosquttio and created the first mqtt in -\> msg.playload out. . I can connect to the Web Interface via Browser from my PC and the MQTT In Button signals "connectet".

So first Test would be a simple "Hello World" message. But i can´t connect the Raspberry PI Broker via any other Client. I am Using MQTTBOX on my PC and MQTTDash on my Android Phone. All got no connection. I disabled the Firewall, changed the router, installt / startet from 0 with node-red at least 4 times. Nothing.

Where / what could the Problem be? Any Input helps 🙂

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [5 August 2021 16:02 UTC](https://discourse.nodered.org/t/can-t-connect-to-node-red-as-client/49386/2 "2021-08-05T16:02:26Z")

</div>

Welcome to the forum.

What version of mosquito did you install? You can find out using the command  
`apt policy mosquitto`  
Or if that doesn't work  
`apt-cache policy mosquitto`

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [5 August 2021 16:12 UTC](https://discourse.nodered.org/t/can-t-connect-to-node-red-as-client/49386/3 "2021-08-05T16:12:21Z")

</div>

Do you have a flow like this, does it work?

 ![Untitled 5](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/2/528ca43581dcfc7e7442f439f56e90e96ade9a32.jpeg)

```auto
[{"id":"27dc528e6536a991","type":"inject","z":"5664307bd8383bfd","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"Hello World","payloadType":"str","x":470,"y":100,"wires":[["850a3353b5a6e8d1"]]},{"id":"47cca5c8c4027c2f","type":"mqtt in","z":"5664307bd8383bfd","name":"","topic":"test","qos":"2","datatype":"auto","broker":"d675b749.04b9c8","nl":false,"rap":true,"rh":0,"x":770,"y":100,"wires":[["47315a995734cddd"]]},{"id":"850a3353b5a6e8d1","type":"mqtt out","z":"5664307bd8383bfd","name":"","topic":"test","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"d675b749.04b9c8","x":610,"y":100,"wires":[]},{"id":"47315a995734cddd","type":"debug","z":"5664307bd8383bfd","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":910,"y":100,"wires":[]},{"id":"d675b749.04b9c8","type":"mqtt-broker","name":"Localhost","broker":"localhost","port":"1883","clientid":"","usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"sessionExpiry":""}]

```

---

<div class="post-metadata">

**Author:** ![Baluba](https://avatars.discourse-cdn.com/v4/letter/b/838e76/32.png) [@Baluba](https://discourse.nodered.org/u/Baluba)\
**Post date:** [5 August 2021 16:16 UTC](https://discourse.nodered.org/t/can-t-connect-to-node-red-as-client/49386/4 "2021-08-05T16:16:43Z")

</div>

Hey, thanks for the reply.

mosquitto:  
Installed: 2.0.11-0mosquitto1~buster1  
Candidate: 2.0.11-0mosquitto1~buster1

Flow is allready there:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/b/2b6ce8de57b2c023242eff16ce2ffad5343b89d9.png)

---

<div class="post-metadata">

**Author:** ![Baluba](https://avatars.discourse-cdn.com/v4/letter/b/838e76/32.png) [@Baluba](https://discourse.nodered.org/u/Baluba)\
**Post date:** [5 August 2021 16:19 UTC](https://discourse.nodered.org/t/can-t-connect-to-node-red-as-client/49386/5 "2021-08-05T16:19:00Z")

</div>

and the Settings from MQTTBOX

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

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [5 August 2021 16:19 UTC](https://discourse.nodered.org/t/can-t-connect-to-node-red-as-client/49386/6 "2021-08-05T16:19:59Z")

</div>

But you don't have any way _in that flow_ to inject "Hello world" and thus prove that Node-Red and Mosquitto are working together before involving another app.

---

<div class="post-metadata">

**Author:** ![Baluba](https://avatars.discourse-cdn.com/v4/letter/b/838e76/32.png) [@Baluba](https://discourse.nodered.org/u/Baluba)\
**Post date:** [5 August 2021 16:24 UTC](https://discourse.nodered.org/t/can-t-connect-to-node-red-as-client/49386/7 "2021-08-05T16:24:11Z")

</div>

ah ok, as far as i have seen it in the "how to" clips from youtube, i just have to puplish to the topic of my choice. in my case /test

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [5 August 2021 16:25 UTC](https://discourse.nodered.org/t/can-t-connect-to-node-red-as-client/49386/8 "2021-08-05T16:25:43Z")

</div>

Does it work without the leading / ?

---

<div class="post-metadata">

**Author:** ![Baluba](https://avatars.discourse-cdn.com/v4/letter/b/838e76/32.png) [@Baluba](https://discourse.nodered.org/u/Baluba)\
**Post date:** [5 August 2021 16:26 UTC](https://discourse.nodered.org/t/can-t-connect-to-node-red-as-client/49386/9 "2021-08-05T16:26:45Z")

</div>

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/1/91ea2096f2ff983fcf46016648eb8d0993678129.png)

flow itself is working

---

<div class="post-metadata">

**Author:** ![Baluba](https://avatars.discourse-cdn.com/v4/letter/b/838e76/32.png) [@Baluba](https://discourse.nodered.org/u/Baluba)\
**Post date:** [5 August 2021 16:28 UTC](https://discourse.nodered.org/t/can-t-connect-to-node-red-as-client/49386/10 "2021-08-05T16:28:48Z")

</div>

i think the main problem is, that i cant establish the connection from any other divice than the rapsberry itself.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [5 August 2021 16:29 UTC](https://discourse.nodered.org/t/can-t-connect-to-node-red-as-client/49386/11 "2021-08-05T16:29:42Z")

</div>

With mosquito V2 if you want to access the broker from a different machine then you have allow that in the mosquito config file. That has been addressed several times here so a search should find it.

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [5 August 2021 16:31 UTC](https://discourse.nodered.org/t/can-t-connect-to-node-red-as-client/49386/12 "2021-08-05T16:31:58Z")

</div>

I have never used MQTBox so I don't know if it is set up correctly.  
Are Node-Red and Mosquitto on a Raspberry Pi?  
What computer has MQTTBox on it?  
Are they both connected to the same network? How - both Wifi, both Ethernet or a mix?

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [5 August 2021 16:33 UTC](https://discourse.nodered.org/t/can-t-connect-to-node-red-as-client/49386/13 "2021-08-05T16:33:36Z")

</div>

Oh! didn't know that! But I currently use Aedes raher than Mosquitto.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [5 August 2021 16:52 UTC](https://discourse.nodered.org/t/can-t-connect-to-node-red-as-client/49386/14 "2021-08-05T16:52:54Z")

</div>

> [@jbudd](#):
>
> I currently use Aedes

I recommend using mosquitto.

---

<div class="post-metadata">

**Author:** ![Baluba](https://avatars.discourse-cdn.com/v4/letter/b/838e76/32.png) [@Baluba](https://discourse.nodered.org/u/Baluba)\
**Post date:** [5 August 2021 16:59 UTC](https://discourse.nodered.org/t/can-t-connect-to-node-red-as-client/49386/15 "2021-08-05T16:59:05Z")

</div>

Sorry, I din´t find it here in the forum. Maybe i chosed the wrong wording. But Google is a friend 🙂  
I dont know exactly why, but the trick is to creat an user account...or so it seems. just googling till it works ^^

For the others with the same problem 🙂

1. creat config file  
sudo nano /etc/mosquitto/conf.d/010-listener-with-users.conf

insert this in the file:  
listener 1883  
password\_file /etc/mosquitto/conf.d/010-access-list  
allow\_anonymous false

1. create accounts - to do so, create another file:  
sudo nano /etc/mosquitto/conf.d/010-access-list  
add users as text (username is the name, and password the password 😉 ):  
username:password  
kitchen:123456  
and:soon

3)sudo mosquitto\_passwd -U /etc/mosquitto/conf.d/010-access-list

i dont know exactly what the last part did...but the magic website told me to do it.

Reboot and it worked.

---

<div class="post-metadata">

**Author:** ![Baluba](https://avatars.discourse-cdn.com/v4/letter/b/838e76/32.png) [@Baluba](https://discourse.nodered.org/u/Baluba)\
**Post date:** [5 August 2021 17:00 UTC](https://discourse.nodered.org/t/can-t-connect-to-node-red-as-client/49386/16 "2021-08-05T17:00:43Z")

</div>

> [@Baluba](#):
>
> he wrong wor

sorry, not my work so here is the Link:  
[https://plantprogrammer.de/mqtt-auf-dem-raspberry-pi-mosquitto/](https://plantprogrammer.de/mqtt-auf-dem-raspberry-pi-mosquitto/)

---

<div class="post-metadata">

**Author:** ![Baluba](https://avatars.discourse-cdn.com/v4/letter/b/838e76/32.png) [@Baluba](https://discourse.nodered.org/u/Baluba)\
**Post date:** [5 August 2021 17:09 UTC](https://discourse.nodered.org/t/can-t-connect-to-node-red-as-client/49386/17 "2021-08-05T17:09:02Z")

</div>

Thanks Colin, that was the input i needet 🙂

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [5 August 2021 19:40 UTC](https://discourse.nodered.org/t/can-t-connect-to-node-red-as-client/49386/18 "2021-08-05T19:40:23Z")

</div>

Also, as mentioned earlier, don't start a topic with a leading /

---

<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:** [4 October 2021 19:41 UTC](https://discourse.nodered.org/t/can-t-connect-to-node-red-as-client/49386/19 "2021-10-04T19:41:23Z")

</div>

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