harmonyhubjs-discover icon indicating copy to clipboard operation
harmonyhubjs-discover copied to clipboard

Port not configurable

Open maddox opened this issue 8 years ago • 3 comments

It looks like this uses port 5224 when doing the UPnP. Because of this, only a single instance of harmonyhubjs-discover can be used on a single computer at a time.

I have a project that uses this, harmony-api. Some people use this at the same time as the Homebridge plugin that also uses harmonyhubjs-discover. When starting one after the other, it breaks, because the port is in use. You can see an issue regarding this here.

If the port was configurable, implementers could pass in a port when starting harmonyhubjs-discover and multiple instances could be used.

maddox avatar Aug 18 '16 05:08 maddox

Port 5224 is used to emit the UDP broadcast into the network (https://github.com/swissmanu/harmonyhubjs-discover/blob/master/lib/ping.js#L8). Any Harmony Hub is listening on this port and replies to the port configured via the Explorers parameter (https://github.com/swissmanu/harmonyhubjs-discover/blob/master/lib/explorer.js#L57)

On https://github.com/swissmanu/harmonyhubjs-discover/blob/master/lib/ping.js#L15, I implemented a bind on the socket once. I am not sure why binding the socket is necessary at all... I try to look into and get rid of this, because this would totally solve the problem.

harmony-api looks cool btw! Glad harmonhubjs-client finds its way into another project. Would you like to be listed in the ecosystems section of harmonhub-clients readme?

swissmanu avatar Aug 18 '16 05:08 swissmanu

Thanks for the fast reply. All that makes sense. It'd be great to get it a little more flexible.

harmony-api looks cool btw!

Thanks! All from standing on your shoulders though, heh. Sure, I'd love it to be listed there, thanks.

maddox avatar Aug 18 '16 06:08 maddox

So is this possible to change the port ad i'm using 1 for homebridge instance and another for harmony-api?

f00j00 avatar Sep 12 '17 23:09 f00j00