Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I spend alot of time then no success with plugin #103

Open
smarta1980 opened this issue Mar 6, 2023 · 4 comments
Open

I spend alot of time then no success with plugin #103

smarta1980 opened this issue Mar 6, 2023 · 4 comments

Comments

@smarta1980
Copy link

smarta1980 commented Mar 6, 2023

I am using nodemcu as mdns server name as: echo
is there any example code to let your plugin to get ip address of nodemcu?

@emcniece
Copy link
Collaborator

emcniece commented Mar 6, 2023

Hi! There is an example app over here, and I see you have found this thread that contains some examples.

It should be possible to find the MDNS broadcast data from a NodeMCU device, and I suspect you might be having trouble searching for a particular type and domain. Are you able to find your NodeMCU device inside an MDNS search app like Discovery? If the zeroconf plugin app is searching for zeroconf.watch('_http._tcp.', 'local.', function(){...}) then the NodeMCU must be broadcasting at local._http._tcp. It's easy to get these backwards.

If you would like more help, please share you code for both your Cordova app and your NodeMCU device.

@smarta1980
Copy link
Author

smarta1980 commented Mar 6, 2023

@emcniece
Thanks for your fast reply, I get results
zeroconf.watch fetch all parameters mdns devices
by the way, what is command to get ip address of specified device:
mdns name: echo
mdns port: 80
I want to get ip of address of it
is there any example?

@emcniece
Copy link
Collaborator

emcniece commented Mar 6, 2023

The watch method in the README is close, it can be adapted like so:

zeroconf.watch('echo.', 'local.', function(result) {
    var action = result.action;
    var service = result.service;
    if (action == 'resolved') {
        console.log('service resolved', service);
        ipAddress = service.ipv4Addresses[0];
        console.log('my IP address:', ipAddress);
    }
});

I'm not completely sure this will find your service though. What is the full mdns hostname that your NodeMCU device is broadcasting as? It should be something like echo.local.

@smarta1980
Copy link
Author

smarta1980 commented Mar 7, 2023

@emcniece
zeroconf.watch('echo.', 'local.', function(result){ }
it is not working to watch specific device
I tried to build app with device android 6.0.1 then it is not working
I want to know what is minimum android version can work with your plugin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants