Sha256: ffd7ff1083e192a74a9bcb846a3bdae4201d231b57b1c609a6cbe2b0636103af

Contents?: true

Size: 1.18 KB

Versions: 11

Compression:

Stored size: 1.18 KB

Contents

require 'rubygems'
require 'bundler/setup'
require 'rack/content_length'
require 'rack/chunked'

port   = ARGV[0] || 7000
secure = ARGV[1] == 'tls'
engine = ARGV[2] || 'thin'
spec   = File.expand_path('../../spec', __FILE__)

require File.expand_path('../app', __FILE__)
Faye::WebSocket.load_adapter(engine)

case engine

when 'goliath'
  class WebSocketServer < Goliath::API
    def response(env)
      App.call(env)
    end
  end

when 'puma'
  events = Puma::Events.new($stdout, $stderr)
  binder = Puma::Binder.new(events)
  binder.parse(["tcp://0.0.0.0:#{port}"], App)
  server = Puma::Server.new(App, events)
  server.binder = binder
  server.run.join

when 'rainbows'
  rackup = Unicorn::Configurator::RACKUP
  rackup[:port] = port
  rackup[:set_listener] = true
  options = rackup[:options]
  options[:config_file] = File.expand_path('../rainbows.conf', __FILE__)
  Rainbows::HttpServer.new(App, options).start.join

when 'thin'
  thin = Rack::Handler.get('thin')
  thin.run(App, :Port => port) do |server|
    if secure
      server.ssl_options = {
        :private_key_file => spec + '/server.key',
        :cert_chain_file  => spec + '/server.crt'
      }
      server.ssl = true
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
faye-websocket-0.10.6 examples/server.rb
faye-websocket-0.10.5 examples/server.rb
faye-websocket-0.10.4 examples/server.rb
faye-websocket-0.10.3 examples/server.rb
faye-websocket-0.10.2 examples/server.rb
faye-websocket-0.10.1 examples/server.rb
faye-websocket-0.10.0 examples/server.rb
faye-websocket-0.9.2 examples/server.rb
faye-websocket-0.9.1 examples/server.rb
faye-websocket-0.9.0 examples/server.rb
faye-websocket-0.8.0 examples/server.rb