Class: Rity::Server

Inherits:
Object
  • Object
show all
Defined in:
lib/rity/server.rb

Class Method Summary collapse

Class Method Details

.start(address, port, app) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/rity/server.rb', line 8

def self.start(address, port, app)
  EM.synchrony do
    trap("INT") { EM.stop }
    trap("TERM") { EM.stop }
    
    EM.epoll
    
    puts "Binding to #{address}:#{port}"
    EM.start_server address, port, Connection, app
  end
end