I’m trying to connect my angular web client using mqtt.js to my local running hivemq-ce broker in docker but it fails:
const url: string = "ws://localhost:8000";
const options: IClientOptions = {
clientId: 'myclient',
username: 'myuser',
password: '',
path: "/mqtt"
};
Docker running:
Extension "Allow All Extension" version 1.0.0 started successfully.
Starting TCP listener on address 0.0.0.0 and port 1883
Starting Websocket listener on address 0.0.0.0 and port 8000
Started TCP Listener on address 0.0.0.0 and on port 1883.
Started Websocket Listener on address 0.0.0.0 and on port 8000.
Started HiveMQ in 2559ms
Connecting to the public hivemq broker with the following settings works:
const url: string = "ws://broker.hivemq.com:8000";
const options: IClientOptions = {
clientId: 'myclient',
username: 'myuser',
password: '',
path: "/mqtt"
};
this.client = mqtt.connect(url, options);
Also connecting backend (java/spring) clients to the local running hivemq-ce broker works.
So why cant the web client connect to the local broker?