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

Typo causes exception #17

Open
shock opened this issue Nov 28, 2020 · 2 comments
Open

Typo causes exception #17

shock opened this issue Nov 28, 2020 · 2 comments

Comments

@shock
Copy link

shock commented Nov 28, 2020

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'))

end
@aberant
Copy link
Owner

aberant commented Dec 6, 2020

woof, that's embarrassing. thanks for taking the time to report this. I'll try to find some free time in the near future to fix this and push a new gem

aberant added a commit that referenced this issue Mar 14, 2024
fixes issue #17
@aberant
Copy link
Owner

aberant commented Jul 21, 2024

Should be fixed in 1.1.5. Let me know.

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