Closed pl7y closed 9 years ago
I tracked down the cause to be a process.on statement at the end of SSDPSearch function in search.js. Commenting down lines 57-61 removes the warning, but I'd like to retain the 'exit' cleansing idea, how can I do it?
Thanks for the info, I need to fix this to only register the process.exit listener once, if it is called multiple times during execution. All the existing tests only perform a single lookup, so I missed this one.
I would suggest that you utilise the other search function, as this SSDP lookup is a throw back to before Phillips provided the discovery service, which should work better in most cases.
I am not at a computer with Node.js at the moment, but I think you could change the code at 57-61 to something like this;
if (!exitFunction) {
exitFunction = function () {
if (!self.closed) {
_close(self);
}
};
// Clean up if close is not called directly
process.on("exit", exitFunction);
}
And put a line at line 8 in the file with:
var exitFunction;
I think that would prevent it from registering multiple times in your app.
I need to put together a test case for this when I get back to a machine I can develop on.
Thank you very much, tomorrow i will try it (it's night here)!
Can the other search function be used without a internet connection?
Il giorno mar 18 ago 2015 23:29 Peter Murray notifications@github.com ha scritto:
I am not at a computer with Node.js at the moment, but I think you could change the code at 57-61 to something like this;
if (!exitFunction) { exitFunction = function () { if (!self.closed) { _close(self); } }; // Clean up if close is not called directly process.on("exit", exitFunction); }
And put a line at line 8 in the file with:
var exitFunction;
I think that would prevent it from registering multiple times in your app.
I need to put together a test case for this when I get back to a machine I can develop on.
— Reply to this email directly or view it on GitHub https://github.com/peter-murray/node-hue-api/issues/55#issuecomment-132357247 .
Ah, no, the other function uses the Internet to connect with the hue discovery service, so you are stuck with the SSDP way then.
When performing some sequential upnpSearch (e.g. to force reconnection upon link going down), node.js EventEmitter gives up since it reaches the maxListeners limit.