0
votes

I have model like this: enter image description here

EMQ X Broker installed at IP 222.x.y.z.

And two Mosquitto client.

I want to publish message from Mosquitto_client_2 then receive Mosquitto_client_1.

I do like this:

Step 1: run command:

mosquitto_sub -h 222.x.y.z -t "TEST_TEST"

on Client_1

enter image description here

Step 2: EMQ X Broker auto create topic "TEST_TEST", like this enter image description here

Step 3: Mosquitto client 2 publish message, run command:

mosquitto_pub -h 222.x.y.z -t TEST_TEST -m "hello world"

But it have problem "Error: Connection refused" like this: enter image description here

I don't know the cause of the error and how to fix this error.

P/s: I also open all port for EMQ X. enter image description here

1
Connection refused implies a firewall somewhere. Are the 2 clients on the same network 1) as each other 2) as the broker?hardillb
p.s. if this broker is publicly accessable via the internet then you really should be using authentication and probably MQTT over SSL/TLShardillb
Thanks, I will check firewall.nistelrooy41001662

1 Answers

0
votes

You should first eliminate the network problem and use telnet to determine whether the port can be accessed.

telnet localhost 1883

Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.