ruby - Starting EventMachine from another file -



ruby - Starting EventMachine from another file -

i wrote simple eventmachine server one:

eventmachine.run eventmachine::websocket.start(:host => host, :port => port) |ws| # snip... end end

now, trigger file in directory. if eventmachine simple ruby class add together run (or something) class method , like:

#!/usr/bin/env ruby $load_path << "./lib" require "my_event_machine" myeventmachine.run

any thought how this? thanks!

you had solution:

my_app.rb:

class myapp def run em.run em::websocket.start(:host => host, :port => port) |ws| # snip... end end end end

run.rb:

#!/usr/bin/env ruby $load_path << "./lib" require "my_app" myapp.new.run

ruby eventmachine

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -