Skip to content
This repository has been archived by the owner on Feb 11, 2020. It is now read-only.

mqtt over websocket on different path #606

Merged
merged 5 commits into from
Mar 14, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions lib/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -609,10 +609,17 @@ Server.prototype.close = function(callback) {
*
* @api public
* @param {HttpServer} server
* @param {String} path
*/
Server.prototype.attachHttpServer = function(server) {
Server.prototype.attachHttpServer = function(server, path) {
var that = this;
ws.createServer({ server: server }, function(stream) {

var opt = { server: server };
if (path) {
opt.path = path;
}

ws.createServer(opt, function(stream) {
var conn = new Connection(stream);
new Client(conn, that);
});
Expand Down
6 changes: 3 additions & 3 deletions test/abstract_server.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ module.exports = function(moscaSettings, createConnection) {
});

function finish () {
client.removeListener('error', finish)
client.stream.removeListener('close', finish)
done()
client.removeListener('error', finish);
client.stream.removeListener('close', finish);
done();
}
}

Expand Down
2 changes: 1 addition & 1 deletion test/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ describe("mosca.Server", function() {
// Simulate a situation that it takes same time to do authorizeSubscribe.
this.instance.authorizeSubscribe = function(client, topic, callback) {
setTimeout(function(){
callback(null, true)
callback(null, true);
}, 300);
};

Expand Down