yocontra / nodecast

Node interface to DIAL/RAMP/ChromeCast
MIT License
163 stars 23 forks source link

Discovery didn't work for me, I needed `explicitSocketBind: true` #21

Open Ciantic opened 5 years ago

Ciantic commented 5 years ago

On my Windows 10 machine I could not find a single device, the problem seems to be with node-ssdp

If I change this:

    this.client = new ssdp.Client();

to

    this.client = new ssdp.Client({
             explicitSocketBind: true
        });

It starts to work.

I don't know how you could change that so that it works for everybody? Maybe it's a Windows thing or not.

Edit: My current workaround (without patching your library) is to do this:

        let network = nodecast.find();
        network.end();

        let client = new Client({
            explicitSocketBind: true
        });
        client.on("response", (headers: any, statusCode: any, rinfo: any) => {
            network.add(headers, statusCode);
        });
        client.search("urn:dial-multiscreen-org:service:dial:1");

        network.on("device", (device: any) => {
            // ...
        });