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

match osc message based on address and types #60

Open
avlapp opened this issue Sep 22, 2022 · 3 comments
Open

match osc message based on address and types #60

avlapp opened this issue Sep 22, 2022 · 3 comments

Comments

@avlapp
Copy link

avlapp commented Sep 22, 2022

In the liblo c/c++ osc library, one can specify a method which matches a osc message based on address and types:

/* add method that will match the path /foo/bar, with two numbers, coerced
 * to float and int */
lo_server_thread_add_method(st, "/foo/bar", "fi", foo_handler, NULL);

So "/error", "sis" matches a other message then "/error", "f"

Is this possible with go-osc?

I see there references to a 'OSC Type Tag String' in the code, but not sure if or how this can be used for pattern matching:
https://github.com/hypebeast/go-osc/blob/cec5a8a1e5f5/osc/osc.go#L220
https://github.com/hypebeast/go-osc/blob/cec5a8a1e5f5/osc/osc.go#L282

Liblo:

https://github.com/radarsat1/liblo/blob/master/examples/example_server.c
https://github.com/radarsat1/liblo/blob/master/lo/lo_types.h

@glynternet
Copy link
Contributor

glynternet commented Oct 8, 2022

This sounds more like some kind of abstraction that could be built on top of what's offered in this package, rather than something that should be included in the package itself.

@hypebeast
Copy link
Owner

Hey @avlapp. Yes, this should is possible since go-osc fully supports type tags. We could extend the StandardDispatcher for example and a new method AddMsgHandlerWithTypespec(addr string, typespec string, handler HandlerFunc) or add a new dispatcher type.

Need to think a little bit about it how the best interface would look like. What do you think @glynternet and @avlapp ?

@glynternet
Copy link
Contributor

glynternet commented Dec 1, 2022

I'm totally fine with the functionality being added 😄

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

3 participants