Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: use UDP to publish/listen for speaker notes (#419)
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 `Vec`s) 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.
- Loading branch information