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

Make this package transport agnostic #1

Open
briansorahan opened this issue Jan 26, 2017 · 1 comment
Open

Make this package transport agnostic #1

briansorahan opened this issue Jan 26, 2017 · 1 comment

Comments

@briansorahan
Copy link
Contributor

Problem

OSC is an encoding, not a protocol.
See Adrian Freed's comments here: https://forum.pjrc.com/threads/18849-Open-Sound-Control
It would be nice to be able to use this package with networking protocols as well as serial.

I'm opening this issue as a way to jot down my ideas about how to do this.

Solutions

1. Encoder/Decoder

We let users provide their preferred io.Reader or io.Writer implementations and encode OSC packets using those.

Advantages

Simplicity

The code in this package could be very clean and concise, truly transport agnostic.

Disadvantages

Sender information

Anytime I write a method that replies to the sender I use the Sender field of the Message type, which is a net.Addr that we get by using ReadFromUDP.

If we go this route then this would have to change (possibly requiring updates to a lot of code).

One idea is to change Sender to an io.Writer. If this feels right in practice then this might make it worth updating everything out there right now that depends on Sender being a net.Addr.

Usability

It might make some people feel that the package is to hard to use if they have to initialize their own io.Reader or io.Writer. Maybe this shouldn't be a big concern because most Go programmers are probably familiar enough with the standard library to not care too much.

2. Conn types

We already have UDPConn.

We could just add TCPConn to round out network protocol support.

And maybe USBConn for serial connections.

Advantages

Package consumers don't need to write as much code.

Disadvantages

We have to maintain more code. We'd probably end up implementing the Encoder/Decoder solution internally anyways.

@avlapp
Copy link

avlapp commented Aug 24, 2022

Interesting thoughts. See also: https://www.cs.cmu.edu/~rbd/papers/o2-icmc-2022.pdf
At the moment there isn't a golang osc library with implemented/ supported TCP support it seems.

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