Class: Hara::Server

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

Class Method Summary collapse

Class Method Details

.start(host, port, options = {}) ⇒ Object



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

def start host, port, options = {}
  puts "Server starting on #{host}:#{port}"
  options = options.merge(host: host, port: port)
  EM.epoll
  EM.run do

    EM::WebSocket.run(options) do |ws|
      ws.onopen { |handshake|
        Hara.filter_pool.async.run_filter handshake, ws
      }
    end

  end
end