# Error: connect ECONNREFUSED

**URL:** https://community.hivemq.com/t/error-connect-econnrefused/1025
**Category:** HiveMQ Cloud
**Created:** [February 21, 2022, 5:02am UTC](https://community.hivemq.com/t/error-connect-econnrefused/1025 "2022-02-21T05:02:15Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![svayio](https://avatars.discourse-cdn.com/v4/letter/s/7c8e57/32.png) [@svayio](https://community.hivemq.com/u/svayio)
#### Post date: [February 21, 2022, 5:02am UTC](https://community.hivemq.com/t/error-connect-econnrefused/1025/1 "2022-02-21T05:02:15Z")

</div>

I have deployed a NodeJS server that communicates with HiveMQ public broker to Bluehost but I have faced this error.

 ![photo_2022-02-21_11-04-25](https://canada1.discourse-cdn.com/flex035/uploads/hivemq1/original/1X/64f05549f91d35c60648a8c653487094f0e4c0b0.jpeg)

My config code:

```auto
var options = {
  host: process.env.MQTT_PUBLIC_BROKER,
  username: process.env.MQTT_USERNAME,
  password: process.env.MQTT_PASSWORD,
  cleanSession: true,
  keepAlive: 60,
  protocol: "mqtt",
  port: process.env.MQTT_PORT,
};

var client = mqtt.connect(options);

```

host: “[broker.hivemq.com](http://broker.hivemq.com)”,  
port: 1883

Thank you.

---

<div class="post-metadata">

### Author: ![Daria\_H](https://avatars.discourse-cdn.com/v4/letter/d/dfb087/32.png) [@Daria\_H](https://community.hivemq.com/u/Daria_H)
#### Post date: [February 21, 2022, 8:23am UTC](https://community.hivemq.com/t/error-connect-econnrefused/1025/2 "2022-02-21T08:23:58Z")

</div>

Hi svayio,

And welcome to our community! You did not ask anything in your ticket, but I guess you are asking for help to “fix” the error?

1. First you need to test if your code works with alternative MQTT Broker. For example, [test.mosquitto.org:1883](http://test.mosquitto.org:1883). Let us know, if you see the error and if it is the same error.
2. Next, please let us know, which MQTT Client library your NodeJS-thing is using. Or where is documentation for the library? If you are following somebodies article or how-to, please share the original link with us.

Thank you,  
Dasha from HiveMQ
