Hello Everyone, I’m new to MQTT and I woul appreciate any help, this is the code I’m using:
import React, { Component } from 'react';
var mqtt = require('mqtt');
var options={
clientId:"ID",
username:"ArdP",
password:"Password",
protocolId: "MQTT",
protocolVersion: 4,
port : 1883 ,
clean:true};
var client = mqtt.connect("mqtt://node02.myqtthub.com/",options)
client.on('connect', () => {
alert('Connected!');
console.log('Connected');
});
class Garage extends Component {
render() {
return (
<div>
<h1>HEllooo</h1>
</div>
);
}
}
export default Garage;
I'm getting the following Error: WebSocket connection to 'ws://node02.myqtthub.com:1883/' failed: Connection closed before receiving a handshake response
Thank you.