module EventMachine::WebSocket

Public Class Methods

run(options) { |c| ... } click to toggle source
# File lib/patch/em_patch.rb, line 35
def self.run(options)
  host, port = options.values_at(:host, :port)
  EM.start_server(host, port, Connection, options) do |c|
    ::Thread.current.abort_on_exception = true
    begin
      yield c
    rescue Exception => exception
      ::Thread.main.raise(exception)
    end
  end
end
start(options, &blk) click to toggle source
# File lib/patch/em_patch.rb, line 25
def self.start(options, &blk)
  #EM.epoll
  #EM.run {
    trap("TERM") { stop }
    trap("INT")  { stop }

    run(options, &blk)
  #}
end