0

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.

Rahul Dey
  • 107
  • 1
  • 11
  • I'm not clear on where you are having the a problem. You want to re-publish the data once it has been saved to the database? What have you already tried? – hardillb Mar 21 '16 at 14:00
  • so in short you are unable to publish the data in first place, is it so? – Nivesh Mar 21 '16 at 15:04

1 Answers1

0

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: './'
  }
});
Henri Cavalcante
  • 455
  • 5
  • 16