简体   繁体   中英

Connection refused: Identifier rejected when try to connect with MQTT broker

I am trying to connect my MQTT broker from angular using MQTTJS . I want to show notification in my website at least once when any message send from anyone on particular topic. but My MQTT connection throw error like : Connection refused: Identifier rejected

For Connection, I used this configuration :

var config = {
      host: <broker url>,
      protocol: 'mqtts',
      username: <username>,
      password: <password>,
      clientId: <client_ID>      
      keepalive: <keeplive time>,
      reconnectPeriod: 10,
      port: 61619,
      clean: false,
      queueQoSZero: false,
}

I can't understand why MQTT throw this error. where am I doing wrong?
any little-bit help would be helpful for me. please help me.

I tried clean: true in configuration that will create new session every time when connect. But due to that, I can't receive my QOS : 1's message after connection.

If this is running in the browser, you can't use mqtts as the protocol you must use ws or wss and the broker must be configured to support MQTT over WebSockets.

Also just to be clear, the host field really should be just a hostname, not a URL

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM