Giter VIP home page Giter VIP logo

Comments (4)

tonetechnician avatar tonetechnician commented on August 15, 2024 1

Ah, I've solved my problem :)

Turns out my server's bonjour was advertising on the incorrect network that the phone was not connected to. After disabling that network (my virtual box network adapter) everything works as it should.

Thanks for the help @becvert, and thanks for maintaining such a great project!

from cordova-plugin-zeroconf.

becvert avatar becvert commented on August 15, 2024

It might be you're missing a dot in _http._tcp => _http._tcp.

from cordova-plugin-zeroconf.

tonetechnician avatar tonetechnician commented on August 15, 2024

Thanks so much for the fast reply. :)

Thanks for noticing that. I've added in the dot and my service is still not showing up.. It seems the callback never happens either.

Not 100% sure why this would be the case.

from cordova-plugin-zeroconf.

tonetechnician avatar tonetechnician commented on August 15, 2024

So just to see if things are working, I've tried to register a service from the phone.

The service is registered successfully and .watch picks it up. My nodejs bonjour also picks it up.

So it seems .watch is unable to pick up my nodejs server's bonjour service advertisement.

Here is my updated code cordova code, any ideas that could shed more light would be great.

    onDeviceReady: function() {
        this.receivedEvent('deviceready');
        var zeroconf = cordova.plugins.zeroconf;
        zeroconf.registerAddressFamily = 'ipv4'; // or 'ipv6' ('any' by default)
        zeroconf.watchAddressFamily = 'ipv4'; // or 'ipv6' ('any' by default)
    
        zeroconf.watch('_http._tcp.', 'local.', function(result) {
            console.log("in watch")
            var action = result.action;
            var service = result.service;
            if (action == 'added') {
                console.log('service added', service);
            } else if (action == 'resolved') {
                console.log('service resolved', service);
            } else {
                console.log('service removed', service);
            }
        });
        
        zeroconf.register("_http._tcp.",'local.','phone',80,{'foo' : 'bar'}, (result) => {
            var action = result.action; // 'registered'
            var service = result.service;
            console.log("registered");
        })
    },

For more info, I'm debugging the android app using USB debugging and chrome dev tools. Not sure this would cause any issue though.

from cordova-plugin-zeroconf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.