Class: OSC::EMServer

Inherits:
Object show all
Defined in:
lib/osc-ruby/em_server.rb

Instance Method Summary collapse

Constructor Details

#initialize(port = 3333) ⇒ EMServer

Returns a new instance of EMServer.



19
20
21
22
23
# File 'lib/osc-ruby/em_server.rb', line 19

def initialize( port = 3333 )
  @port = port
  setup_dispatcher
  @tuples = []
end

Instance Method Details

#add_method(address_pattern, &proc) ⇒ Object



29
30
31
32
33
# File 'lib/osc-ruby/em_server.rb', line 29

def add_method(address_pattern, &proc)
  matcher = AddressPattern.new( address_pattern )

  @tuples << [matcher, proc]
end

#runObject



25
26
27
# File 'lib/osc-ruby/em_server.rb', line 25

def run
  EM::run { EM::open_datagram_socket "localhost",  @port, Connection }
end