Sha256: 9ecfef3165d8f802f66ae75f95b6d3e93f73695b52e995dac44cff440d0bd34b

Contents?: true

Size: 487 Bytes

Versions: 2

Compression:

Stored size: 487 Bytes

Contents

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hara-0.4.0 lib/hara/server.rb
hara-0.3.0 lib/hara/server.rb