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

service discovery - announce _teleplot._udp via mDNS-SD #18

Open
mhaberler opened this issue Apr 26, 2023 · 4 comments
Open

service discovery - announce _teleplot._udp via mDNS-SD #18

mhaberler opened this issue Apr 26, 2023 · 4 comments

Comments

@mhaberler
Copy link

planning to add mDNS-SD service announcements so teleplot clients can find a local teleplot server automatically

following this example: https://github.com/mdns-js/node-mdns-js/blob/master/examples/service.js

are you willing to entertain PR's for that?

thanks for the great tool, btw! really appreciated

Michael

ps: any plans to bring up the VSCode teleplot plugin on par with this server in terms of features? seems 3D mode is missing

@nesnes
Copy link
Owner

nesnes commented Apr 28, 2023

I do like the idea but have questions on how it will work.
Teleplot usage is more oriented toward a local server instance (on 127.0.0.1) , or to a pre-defined 1-to-1 setup.

Advertising a DNS name on the network might confuse two person using teleplot (for their own purpose) while being connected on the same network (like in an office). What we don't want is the telemetry from personA plotted on personB's PC. This concern is true for both privacy, performances and usability reasons.

(ye I do plan to update the VSCode plugin to match recent updates but I didn't dedicated the necessary time yet)

@mhaberler
Copy link
Author

mhaberler commented Apr 28, 2023

I do have a working implementation server- and client (Arduino) side, need to clean up before publishing, should be a few days

the way I did it is:

  • server can be started with option mDNS announcement (command line flag)
  • client can explicitly configure a IP:port destination in 'EEPROM'
  • if the latter is unset, client will pick the first mDNS announcement as destination

client can also explicitly browse for announcements, and displays what she discovers
you can then pick one from the list to be saved permanently - if you dont, the first announcement will still win

to address your concern, one could disable the 'pick first announcement if not configured explicitly' behavior

this makes the simple case easy and the complicated possible

Michael

@mhaberler
Copy link
Author

mhaberler commented May 1, 2023

this branch has the mDNS announcement

client examples forthcoming

(sorry for the whitespace reformat)

@mhaberler
Copy link
Author

mhaberler commented May 5, 2023

here's an ESP32 Arduino example which does mDNS discovery:

https://github.com/mhaberler/esp32-imu-baro/blob/master/src/teleplot/arduino.cpp

I did rewrite Teleplot.h into https://github.com/mhaberler/esp32-imu-baro/blob/master/src/teleplot/Teleplot.h massively for embedded use

  • shave off iostream = -300kB code space
  • use fmtlib instead
  • separate instantiation and parameterization Arduino-style with begin_*()
  • make TELEPLOT_ENABLE a runtime flag (enabled_)
  • took out TELEPLOT_USE_FREQUENCY - this is pushing things a bit on an ESP32

the changes were so extensive I dropped the idea of retaining your API - sorry for that

there's a native (in my case MacOS) example here, without service discovery: https://github.com/mhaberler/esp32-imu-baro/blob/master/src/teleplot/native.cpp

what do you think?

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