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

feat: use UDP to publish/listen for speaker notes #419

Merged
merged 2 commits into from
Jan 22, 2025

Conversation

mfontanini
Copy link
Owner

This is a followup to #389 that uses UDP sockets and loopback broadcast addresses to publish and listen for speaker notes. The previous solution using iceoryx2 was using shared memory to communicate between different presenterm instances. This is fine but was causing a couple of issues:

  • When trying to compile presenterm in a clean system I found I needed libclang (?) to build it. I'm not sure what transitive dependency needs this but I don't really want to deal with having builds that require having external libraries installed for it to work. e.g. this means we'd have to do something about the CI as it will likely fail to build the release artifacts as it is.
  • This was pulling in roughly ~60 extra dependencies. I like to be conservative with dependencies and while I'd be okay with pulling this many if it really solved a problem that would be annoying to solve otherwise, I think this is not the case.
  • Not an issue right now but the events sent were limited to statically allocated pieces of memory (e.g. no Vecs) which could cause future evolutions of this solution to require hacky workarounds.

This new solution instead uses JSON over UDP sockets. Note that nothing internally in how speaker notes are parsed/managed has changed, it's just the communication protocol that did. This works like this:

  • The publisher binds a UDP port to a random port and sends events to a broadcast address on the loopback interface (e.g. 127.255.255.255:<some port>).
  • Listeners will bind to that same broadcast address using a non blocking socket and will listen for events as usual. Listeners use SO_REUSEADDR to allow multiple listeners on the same port as otherwise each packet goes to a single listener.

Events sent contain the full presentation path so this allows having multiple publishers and listeners using different presentations but listening on the same port. This is the equivalent of the service name we had before.

As part of this I also changed the CLI parameters to be --publish-speaker-notes and --listen-speaker-notes as they're a bit shorter. Also I added a speaker_notes.always_publish configuration parameter that causes the tool to always publish speaker notes unless you're running in listen mode.

cc @dmackdev sorry this undoes some of the code you wrote but this was causing a few issues (see above). I really appreciate the effort you put into implementing this as the issue had been open for a long time and the solution you came up with was very simple and effective!

@mfontanini mfontanini merged commit 4bb9705 into master Jan 22, 2025
6 checks passed
@mfontanini mfontanini deleted the feat/udp-speaker-notes branch January 22, 2025 00:53
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

Successfully merging this pull request may close these issues.

1 participant