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

ESP8266mDNS - Add support for overwriting/removing TXT records #3212

Closed
WeeJeWel opened this issue May 7, 2017 · 5 comments
Closed

ESP8266mDNS - Add support for overwriting/removing TXT records #3212

WeeJeWel opened this issue May 7, 2017 · 5 comments

Comments

@WeeJeWel
Copy link

WeeJeWel commented May 7, 2017

I advertise a device's name on mDNS using MDNS.addServiceTxt("myservice", "tcp", "name", "Foo");, but this name can change over time by user input. When calling the method again, another TXT entry is added, but I expected the previous one to be replaced.

@igrr
Copy link
Member

igrr commented May 8, 2017

@swarren and @ccooper21 have contributed to mDNS library recently. Maybe they would be willing to implement this?

Alternatively, you can get MDNS object into a clean state like this:

MDNS = MDNSResponder();

which should delete the old one, freeing all resources, and create a new one. Now if this doesn't work for some reason, feel free to open a new issue :)

@mkillewald
Copy link
Contributor

mkillewald commented Dec 7, 2017

I realize this is probably low priority, but I would like to see support for being able to change or remove TXT records as well. I could not get the suggestion of MDNS = MDNSResponder() to work. It clears the MDNS object but then I can't seem to re-initialize the object with either MDNS.begin(), MDNS.setInstanceName(), or MDNS.addService().

UPDATE: I have added a method to clear the TXT record as a whole. This will clear all key, value pairs and allow the entire TXT record to be rebuilt as needed. I will submit a pull request.

mkillewald pushed a commit to mkillewald/Arduino that referenced this issue Dec 8, 2017
@romuye123
Copy link

@mkillewald
Thanks for the UPDATE. But when I keep monitoring the updates on my Android app, the updates are not realtime / immediate.

  MDNS.clearServiceTxt("http", "tcp");
  MDNS.addServiceTxt("http", "tcp", "name",myname); 

Please suggest if I am wrong or let me know how can I instantly update my client mobile app.

@mkillewald
Copy link
Contributor

@romuye123
Due to the nature of mDNS the updates are not going to occur immediately. As a work around for this in my mobile clients, I've made a refresh action that drops all discovered nodes and re-discovers them causing the changes to be shown. Hope that helps!

@devyte
Copy link
Collaborator

devyte commented Dec 5, 2018

Closing in view of #5442 with a full rewrite of mdns.

@devyte devyte closed this as completed Dec 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants