简体   繁体   中英

MQTT server to client communication

I want to communicate between server and client using mosca.At first case i subscribe and publish data from client.And receive that data into server.But i face some problem again i want publish the data from server and receive that data from same client.

Example: From front-end send same data to the server.After receiving those data i want store those data in database.After save the data i want send the some response(data) to the same client using Mosca(in Javascript).

Thanks for giving answer.

If you trying to use a MQTT client on browser you should use a option to activate websocket.

Something like this:

const mosca = require("./");
const server = new mosca.Server({
  http: {
    port: 3000, //use this port to connect
    bundle: true,
    static: './'
  }
});

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