-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Description
Greetings and thanks for this lib. Please check the following line for a typo.
https://github.com/aberant/osc-ruby/blob/master/lib/osc-ruby/server.rb#L61
mesg should be message
/Users/guest/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/osc-ruby-1.1.4/lib/osc-ruby/server.rb:61:in `block in dispatch_message': undefined local variable or method `mesg' for #<OSC::Server:0x00007f9aa113a0e0> (NameError)
Did you mean? message
The server still seems to work in my test app after the exception, but obviously something isn't going according to plan. See my code below. This only happens when the sleep is there, which I don't need, but I thought you'd want to know. Cheers.
EventMachine.run do
server = Server.new $PORT
puts "OSC server started on port #{$PORT}"
server.add_method /.*/ do |message| # this will match any address
p "/.*/: #{message.ip_address}:#{message.ip_port} -- #{message.address} -- #{message.to_a} }"
end
server.add_method %r{foo/.*} do |message| # this will match any /foo node
p "%r{foo/.*}: #{message.ip_address}:#{message.ip_port} -- #{message.address} -- #{message.to_a} }"
end
server.add_method "/foo/bar" do |message| # this will just match /foo/bar address
p "'/foo/bar': #{message.ip_address}:#{message.ip_port} -- #{message.address} -- #{message.to_a} }"
end
server.add_method "/exit" do |message| # this will just match /exit address
exit
end
Thread.new do
server.run
end
sleep 1
# hit Control + C to stop
Signal.trap("INT") { server.stop }
Signal.trap("TERM") { server.stop }
client = Client.new 'localhost', 8001
client.send( OSC::Message.new( "/greeting" , "hullo!" ))
client.send Message.new('/foo/bar', 1, 1.2, 'a string')
client.send Message.new('/foo/bar/zar', 1, 1.2, 'a string')
# client.send Bundle.new(Time.now + 2, Message.new('/exit'))
endMetadata
Metadata
Assignees
Labels
No labels