Это в документах здесь . Вы можете передать как host
, так и port
как часть объекта параметров при создании нового объекта mosca.Server
.
var pubsubsettings = {
//using ascoltatore
type: 'mongo',
url: 'mongodb://localhost:27017/mqtt',
pubsubCollection: 'ascoltatori',
mongo: {}
};
var moscaSettings = {
port: 1883, //mosca (mqtt) port
host: "127.0.0.1",
backend: pubsubsettings //pubsubsettings is the object we created above
};
var server = new mosca.Server(moscaSettings); //here we start mosca
server.on('ready', setup); //on init it fires up setup()
// fired when the mqtt server is ready
function setup() {
console.log('Mosca server is up and running')
}