i8beef/node-red-contrib-castv2

Possible Breaking Change

Closed this issue ยท 12 comments

I installed Node.js V18 and mDNS stopped working.
I tried V17 (I know we don't normally use odd number versions) then it worked again, so I have reverted back to V16.

Is this a known issue?

Well the main node-red docker images are still on 14.8.2 I believe, so I haven't tried it yet. Is that ALL you upgraded, or did you do a full system upgrade (I believe the mDNS resolution piggy backs on system stuff so if the system broke mDNS somehow, it might be upstream)? Any errors of note in the node-red logs or in a catch node?

Yes that was the only thing I upgraded. I will take a look back through the logs to see if there was anything.
If can't find anything, I will run the upgrade again and stick a catch node in.

Sorry for the delay in replying!
I don't use docker, I have a native install.
I see this in the logs:

0|node-red | Error: connect ECONNREFUSED 0.0.0.0:8009
0|node-red | at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1195:16) {
0|node-red | errno: -61,
0|node-red | code: 'ECONNREFUSED',
0|node-red | syscall: 'connect',
0|node-red | address: '0.0.0.0',
0|node-red | port: 8009
0|node-red | }

The lack of any other errors implies the mDNS discovery succeeded, it just didn't find the specified target. When you edit the node settings do you see ANY targets showing up, or is this the only one you have to discover?

I don't see any bugs related to the bonjour library I'm using here...

One thing I can think of here is that it allows for up to 3 seconds of discover for the mDNS protocol: anything that doesn't respond in that time wouldn't show up. An easy test for that might be to just edit the node_modules/node-red-contrib-castv2/castv2-sender.js file, and at the very bottom you'll find the method that calls the mDNS discovery with a timeout (

). If you change that 3000 to something else you could extend that timeout to see if it makes a difference, and if it does I could add a setting for that so you could change it.

You could also run an mDNS discover on the machine itself with something else to see if theres something network related blocking... I think on Linux that's avahi-browse but Im not super familiar with it...

I don't know how technical you are, but another option that would be a good 1:1 would be to write a quick little node app that uses the same library (bonjour) to run a discovery and then spits out the results... you could basically just do this in a new node app, run it and see what it discovers:

                const bonjour = require('bonjour')();
                const bonjourBrowser = bonjour.find(
                    { type: 'googlecast' },
                    service => {
                        console.log(service);
                    });

Thanks for your all your help!

Tried increasing to 10 sec and no difference.
I have 9 cast devices but nothing appears in the dropdown.
Created an app with your code above, finds all 9 under Node.js 16.15 but when using node.js 18.3 just sits and never returns anything. So has to be something within 18 that is causing the issue.Had a look through the change logs but nothing seems to jump out.

I have put back to 16.15 and all working fine. Not a major issue for me to revert back, but would be good to know if anyone else has had a similar issue.

The library I'm using hasn't been updated in a while... it looks like there's a more active fork that people have started moving to, I might have to give that a try and see if it makes a difference...

Dont suppose you could try switching out that dependency for this one (in the test app) and try it again? It should be the same basic code just using bonjour-service instead of bonjour... https://www.npmjs.com/package/bonjour-service

If not that's fine, I will get around to testing it out eventually, I just don't have a setup on the newer node yet.

I was able to download a standalone node 18 and try this. Indeed, the old library has an issue somewhere, but that bonjour-service works fine. Ill have to look at moving over to that soon. Thanks for the heads up.

I just pushed up a new branch (referenced above) that uses the newer library. You are welcome to try it out with node 18 and see if it works better for you. I havent had time to test it yet, so use at your own risk, but should be ok ๐Ÿ˜„

Wow, I will give it a try later today. Was going to look into your previous post :)

Thanks for looking at that so quickly!
Reloaded V18.3 and your branch and all is working as before.

Ok, I just pushed 4.2.1, should be able to upgrade to that here soon.

Since you said the branch worked, and my local seems to not be horribly broken at the moment, Im gonna close this for now as fixed. If you have more issues, feel free to reopen! Thanks!