Sha256: 6cb6d6c24ceb4cb356efdaab8987feb8656fbbf3e4849bab445482c1e43ef3bf

Contents?: true

Size: 565 Bytes

Versions: 4

Compression:

Stored size: 565 Bytes

Contents

require "faye/websocket"
require "useragent"

module Blade::Server
  extend self
  include Blade::Component

  WEBSOCKET_PATH = "/blade/websocket"

  def start
    Faye::WebSocket.load_adapter("thin")
    Thin::Logging.silent = true
    Thin::Server.start("localhost", Blade.config.port, app, signals: false)
  end

  def websocket_url(path = "")
    Blade.url(WEBSOCKET_PATH + path)
  end

  def client
    @client ||= Faye::Client.new(websocket_url)
  end

  private
    def app
      Rack::Builder.app do
        run Blade::RackAdapter.new
      end
    end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
blade-0.4.1 lib/blade/server.rb
blade-0.4.0 lib/blade/server.rb
blade-0.3.2 lib/blade/server.rb
blade-0.3.1 lib/blade/server.rb