moscajs / mosca

MQTT broker as a module
mosca.io
3.2k stars 513 forks source link

How to enable only http port? #709

Closed tsaiyl closed 6 years ago

tsaiyl commented 6 years ago

Hi,

I want to disable the default mqtt port, and enable only http port. Is this possible?

mcollina commented 6 years ago

There is the httpOnly option

tsaiyl commented 6 years ago

Sorry for re-opening. How do I use this option?

Wiki does not mention anything about this option, searching httpOnly in source code found only a comment about this option, but no code actually parses it.

I tried this:

var moscaSettings = {
  httpOnly: true,
  http: {
    port: process.env.VCAP_APP_PORT || 8080
  },
  ...
}

and it doesn't seem to do anything : port 1883 is still enabled.

mcollina commented 6 years ago

Use aedes: https://github.com/mcollina/aedes/blob/master/example.js.