angular – Whats Wrong here MQTT-IONIC 5

I´m trying to established a connection between my ionic app and mosquitto broker.

When i run the app, this error appears.

I´m using ngx-mqtt v9.0.5, Angular v12.1.1, eclipse-mosquitto v2.0.13 and Ionic v5.


Browser Error:

WebSocket connection to ‘ws://localhost:1884/’ failed:

Running Mosquitto broker in command line:

New connection from 127.0.0.1:55745 on port 1884.

Client disconnected due to malformed packet.


I´m providing the follow information in the ionic app.

const MQTT_SERVICE_OPTIONS: IMqttServiceOptions = {

  connectOnCreate: false,

  hostname: 'localhost',

  port: 1884,

  path: '/mqtt',

  protocol: 'ws'

};

Read more here: Source link