require 'em-websocket' require 'eventmachine' module Hara class Server class << self 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 end end end