Closes the server.
Server.prototype.close = function(callback) {
var that = this;
callback = callback || function() {};
async.parallel(Object.keys(that.clients).map(function(id) {
return function(cb) {
that.closeConn(that.clients[id], cb);
};
}), function() {
that.once("closed", callback);
try {
that.server.close(function() {
debug("closed");
that.emit("closed");
});
} catch(exception) {
callback(exception);
}
});
};
Server
Server()
The Mosca Server is a very simple MQTT server that supports
only QoS 0.
It is backed by Ascoltatori, and it descends from
EventEmitter.
Options
port, the port where to create the server.backend, all the options for creating the Ascoltatore that will power this server.Events
clientConnected, when a client is connected; the client is passed as a parameter.clientDisconnected, when a client is disconnected; the client is passed as a parameter.published, when a new message is published; the packet and the client are passed as parameters.