search

Home  >  Q&A  >  body text

How to subscribe to multiple topics using mqtt in js?

If you want to obtain the numerical changes of sensors in real time, each sensor has a unique data_id.
The front end is using mqtt to combine multiple data_ids into an array and subscribe as a topic.
But it only successfully subscribes The first data_id was retrieved, but the others did not respond.
What should I do if I want to subscribe to multiple topics on the front end?

伊谢尔伦伊谢尔伦2788 days ago1074

reply all(1)I'll reply

  • PHPz

    PHPz2017-05-19 10:30:56

    It is not recommended that js directly subscribe to mqtt. The server should subscribe to mqtt. In addition, multiple client ids are required to subscribe to multiple topics.

    reply
    0
  • Cancelreply