-
Notifications
You must be signed in to change notification settings - Fork 16
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
Route Part of a Namespace #3
Comments
OSC::Message has an address method and OSC supports wildcards. i'm wondering if something like this wouldn't help you @server.add_method "/example/test/*" do |message|
new_address = message.address.gsub('/example/test', '')
@client.send(OSC::Message.new(new_address, *message.to_a))
end let me know if it doesn't help and i'd be more then glad to offer further assistance. |
Thanks, that's great and mostly solves my problem. I'm pretty new to Ruby, One problem that remains is that the wildcard will only route a single As far as I can see, I don't think this is supported directly by the OSC Graham. On Fri, Jul 15, 2011 at 7:33 PM, aberant <
|
Ah, i better understand what you are trying to do now. I've been thinking about implementing some routing features in the past and i think this is the push i need to implement them. "The simplest thing that could work" would probably be a new wildcard character. it would be something like "/example/test/**" that will match ALL sub containers of /example/test. you could then easily implement your own routing code for your needs. does that sound reasonable to you? |
It does make a lot of sense, although I'm in two minds at to whether the Incoming message = /example/test/this/one 1 Namespace to match = Result = Having looked at the OSC 1.0 spec it doesn't really cover this kind of A part of an OSC Address Pattern matches a part of an OSC Address if every So it mentions that they can match, but it does not define what should occur If this makes sense, how long do you think it would take to implement? It Thanks, Graham. On 17 Jul 2011, at 17:27, aberant < Ah, i better understand what you are trying to do now. I've been thinking Reply to this email directly or view it on GitHub: |
I've got the double splat code up on this branch pull it down and then "rake gem" it to create a gem for your project to use instead of the official one this code gives you a ** matcher to match every sub container like @server.add_method "/example/test/**" do |message|
new_address = message.address.gsub('/example/test', '')
@client.send(OSC::Message.new(new_address, *message.to_a))
end i'd like to hold off creating a method for routing right now until i can get a better idea of the ways you would use it. please let me know if this helps. |
Thanks, that's great, I'll get a chance to try it out in the next Graham. On 18 Jul 2011, at 18:34, aberant
|
HI, Just had chance to test this tonight after getting bogged down in installing Graham, On Tue, Jul 19, 2011 at 2:51 PM, Graham Booth graham.r.booth@gmail.comwrote:
|
Needed the double splat today to forward all osc messages to a non-osc server, and that branch worked great for me. Would very much like to see it merged in! |
i've been thinking about this and think i'll do it even tho it's not part of the OSC spec. maybe it will encourage them do include it in the spec. might take me a little bit to update the documentation |
i've merged this to double splat branch into master, but it's not in the v1.0.0 gem. i want to update the docs and examples before i include it in the gem. if you use bundler, just point it at the github repo for now to get these features. gem "osc-ruby", :git => "git://github.com/aberant/osc-ruby.git" |
Hi,
I'm doing some work with the osc-ruby library and it's been great so far, but I've run into a problem. Basically, I'd like to route part of a namespace and pass on what follows (similarly to how osc-route operates in Max/MSP). For example, if I'm monitoring the following namespace:
"/example/test/"
and I send the message:
"/example/test/my/namespace 5.0"
I'd like osc-ruby to pass on "/my/namespace 5.0"
Is there a simple way to do this?
Thanks,
Graham.
The text was updated successfully, but these errors were encountered: