Rahul Dey
Rahul Dey

Reputation: 107

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.

Upvotes: 0

Views: 193

Answers (1)

Henri Cavalcante
Henri Cavalcante

Reputation: 505

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: './'
  }
});

Upvotes: 0

Related Questions