Module: EventMachine::WebSocket
- Defined in:
- lib/patch/em_patch.rb
Class Method Summary collapse
Class Method Details
.run(options) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/patch/em_patch.rb', line 35 def self.run() host, port = .values_at(:host, :port) EM.start_server(host, port, Connection, ) do |c| ::Thread.current.abort_on_exception = true begin yield c rescue Exception => exception ::Thread.main.raise(exception) end end end |
.start(options, &blk) ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/patch/em_patch.rb', line 25 def self.start(, &blk) #EM.epoll #EM.run { trap("TERM") { stop } trap("INT") { stop } run(, &blk) #} end |