You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After moving my program using node-tradfri-client to another vlan/subnet. It is not able to discover the ikea gateway anymore(it still works when program and gateway are on the same subnet)
I have done some tests with mdns-server used by node-tradfri-client and I think there is some race in that which are causing this issue:
When I just do the same thing as node-tradfri-client does for the discoverGateway function. I never see the answer to the query _coap._udp.local
If I let my test program run still listening for response packets and then do a avahi-browse _coap._udp -d local (after setting up avahi) I can see that mdns-server actually gets the response packet and print it out (with the conditions that you use in node-tradfri-client - that the name should match _coap._udp.local)
I then put in some console.logs in the response part and in the query part. I can then see that we are inside the query part before the response/listening part. So I think mdns-server in some circumstances doesn't listen when the query is sent
Also when using the same testprogram on the same subnet it seems that mdns-server doesn't see all the response packages(I am not quite sure of this, but I think I saw fewer responses than when doing the query via avahi-browse)
I am not a very experienced with development in javascript, but I tried moving the 'ready' event around in mdns-server, but not with great success
This is the small test program I used for mdns-server:
var mdns = require('mdns-server')({
reuseAddr: true, // in case other mdns service is running
loopback: false, // receive our own mdns messages
noInit: true // do not initialize on creation
})
domain = '_coap._udp.local'
mdns.on("response", (resp) => {
console.log("In response");
const allAnswers = [...resp.answers, ...resp.additionals];
const result = allAnswers.find(a => a.name === domain);
if (result != null)
console.log(result);
});
mdns.on("ready", () => {
console.log("In query");
mdns.query([
{ name: domain, type: "A" },
{ name: domain, type: "AAAA" },
{ name: domain, type: "PTR" },
{ name: domain, type: "SRV" },
{ name: domain, type: "TXT" },
]);
});
mdns.initServer();
I then tried to do a test with another mdns npm package bonjour-discovery. That finds the ikea gateway right away when it is run from another subnet. I noticed that it has a referer field in it (maybe mdns-server doesn't handle that this is present). This is the output running from another subnet:
I am not sure how to proceed(probably a bug report at the mdns-server project), but it seems mdns-server doesn't handle the mdns between different subnets usecase
My current focus is trying to change the discoverGateway part og node-trafri-client to use bonjour-service instead - so I can get my program working (a plugin for the root music server to turn on/off an ikea switch when music plays/doesn't play)
The text was updated successfully, but these errors were encountered:
Hi
After moving my program using node-tradfri-client to another vlan/subnet. It is not able to discover the ikea gateway anymore(it still works when program and gateway are on the same subnet)
I have done some tests with mdns-server used by node-tradfri-client and I think there is some race in that which are causing this issue:
When I just do the same thing as node-tradfri-client does for the discoverGateway function. I never see the answer to the query _coap._udp.local
If I let my test program run still listening for response packets and then do a avahi-browse _coap._udp -d local (after setting up avahi) I can see that mdns-server actually gets the response packet and print it out (with the conditions that you use in node-tradfri-client - that the name should match _coap._udp.local)
I then put in some console.logs in the response part and in the query part. I can then see that we are inside the query part before the response/listening part. So I think mdns-server in some circumstances doesn't listen when the query is sent
Also when using the same testprogram on the same subnet it seems that mdns-server doesn't see all the response packages(I am not quite sure of this, but I think I saw fewer responses than when doing the query via avahi-browse)
I am not a very experienced with development in javascript, but I tried moving the 'ready' event around in mdns-server, but not with great success
This is the small test program I used for mdns-server:
I then tried to do a test with another mdns npm package bonjour-discovery. That finds the ikea gateway right away when it is run from another subnet. I noticed that it has a referer field in it (maybe mdns-server doesn't handle that this is present). This is the output running from another subnet:
I am not sure how to proceed(probably a bug report at the mdns-server project), but it seems mdns-server doesn't handle the mdns between different subnets usecase
My current focus is trying to change the discoverGateway part og node-trafri-client to use bonjour-service instead - so I can get my program working (a plugin for the root music server to turn on/off an ikea switch when music plays/doesn't play)
The text was updated successfully, but these errors were encountered: