-
-
Notifications
You must be signed in to change notification settings - Fork 506
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a unit test for this?
I don't see we have any test for attachHttpServer yet, I'm creating a new one then. |
added some unit tests, however, there are a few things:
|
"uglify-js": "^2.4.16", | ||
"underscore": "^1.7.0" | ||
"underscore": "^1.7.0", | ||
"ws": "^1.0.1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be a real dependency, not a devDependency
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
forget about it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So what do you mean? Would it be ok now then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's ok, my bad.
Keep the same behaviour as it was before, like it's now in code.
|
I know it is possible to have server with all interface. My point is that when I'm attaching to an existing http server, I don't want the port 1883 to be occupied, that's the reason why I'm using mqtt-over-ws. |
You can just specify the interfaces you want to listen to, or none. |
the problem is if I specify none, there will still be a mqtt server listens on port 1883. |
oh do you mean I should do
?
And this occupies my 1883 port. |
Yes, |
The following test failed, it's throwing Error: no interface defined it.only("should not occupy 1883 port while attached to http server", function(done) {
server = http.createServer();
mqttServ = new mosca.Server({interfaces:[]});
mqttServ.attachHttpServer(server);
}); |
Would you mind sending a fix? |
sure, I just want to make sure your intention in that case. I'll send another commit. |
fixed empty interfaces options, refactored the tests to reflect this. |
hi Matteo, do you have a plan to merge? Thanks |
I'm traveling till the end of this week, I will have a look afterwards. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work, just a minor nit.
lib/options.js
Outdated
// if (opts.interfaces.length === 0) { | ||
// result.addError('no interfaces were defined'); | ||
// } | ||
// } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why this has been commented? If this is not needed anymore, we should just remove it.
Hi Matteo, that code block was under the assumption that there should be minimum one interface in the option. However this doesn't hold anymore due to the case where you are attaching the mqtt stack on an existing http server. I deleted that code block. |
perfect, I'll try to assemble a release asap. |
Fixes this #605