# Webpage using Paho JS to publish to subscriber

**URL:** <https://community.hivemq.com/t/webpage-using-paho-js-to-publish-to-subscriber/2995>\
**Category:** Uncategorized\
**Created:** [June 16, 2024, 3:05pm UTC](https://community.hivemq.com/t/webpage-using-paho-js-to-publish-to-subscriber/2995 "2024-06-16T15:05:23Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![SShet](https://avatars.discourse-cdn.com/v4/letter/s/b3f665/32.png) [@SShet](https://community.hivemq.com/u/SShet)\
**Post date:** [June 17, 2024, 7:53am UTC](https://community.hivemq.com/t/webpage-using-paho-js-to-publish-to-subscriber/2995/2 "2024-06-17T07:53:35Z")

</div>

Certainly! Here’s the revised response:

* * *

Hello @village_idiot,

Welcome to the HiveMQ Community Forum. We’re delighted to see your interest in MQTT and HiveMQ Cloud.

You are correct; the error you encountered is due to the client not being connected.

To resolve this issue, please use the following code to establish a successful connection to HiveMQ Cloud: For more details, please refer to this [post](https://community.hivemq.com/t/javascrip-paho-webclient-with-hivemq-account-uri-not-working/2756/3).

```javascript
var MQTT_CLIENT = new Paho.MQTT.Client("wss://[hivemq cloud cluster url]:8884/mqtt", "your client id");

```

We hope this helps. If you have any further questions, please feel free to ask.

Best regards,  
Sheetal from HiveMQ Team

---

_[View the full topic](https://community.hivemq.com/t/webpage-using-paho-js-to-publish-to-subscriber/2995)._
