Comments (4)
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.
It might be you're missing a dot in _http._tcp
=> _http._tcp.
from cordova-plugin-zeroconf.
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.
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)
- Crash acquireing jMulticastLock under-locked ZeroConfPluginLock HOT 1
- remove dependency on cordova-plugin-add-swift-support
- I spend alot of time then no success with plugin HOT 4
- Cordova-cli 9 support HOT 9
- Please add support for Swift 4 (solution) HOT 2
- No IP, TXT records or resolved events HOT 7
- Swift 4 error HOT 2
- [IOS] zeroconf can't find new services after switch wifi HOT 2
- Does not find service published with bonjour on windows HOT 1
- iOS Crash HOT 11
- zeroconf.watch not working on Android 9 HOT 3
- Blocking Angular Change Detection HOT 2
- Why do you install 3d party plugging that mess up our files HOT 1
- stop loading node modules into our apps with 3d party plugs HOT 3
- Plugin does not request Local Network Usage Permission in iOS 14 HOT 6
- getHostName on Android 8 and 10 failing HOT 2
- iOS Build error: Cannot find 'Hostname' in scope HOT 6
- added but won't resolve HOT 1
- How to query? HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cordova-plugin-zeroconf.