Sha256: 1645cba3f991cc739a8b4f901f38f9f7aa504064fdb2dea985cd16db751025c5

Contents?: true

Size: 634 Bytes

Versions: 6

Compression:

Stored size: 634 Bytes

Contents

module Capybara::Poltergeist
  class Server
    attr_reader :socket, :fixed_port, :timeout

    def initialize(fixed_port = nil, timeout = nil)
      @fixed_port = fixed_port
      @timeout    = timeout
      start
    end

    def port
      @socket.port
    end

    def timeout=(sec)
      @timeout = @socket.timeout = sec
    end

    def start
      @socket = WebSocketServer.new(fixed_port, timeout)
    end

    def stop
      @socket.close
    end

    def restart
      stop
      start
    end

    def send(command)
      @socket.send(command.id, command.message) or raise DeadClient.new(command.message)
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
poltergeistFork-0.0.4 lib/capybara/poltergeist/server.rb
poltergeistFork-0.0.3 lib/capybara/poltergeist/server.rb
poltergeistFork-0.0.2 lib/capybara/poltergeist/server.rb
poltergeistFork-0.0.1 lib/capybara/poltergeist/server.rb
poltergeist-1.8.1 lib/capybara/poltergeist/server.rb
poltergeist-1.8.0 lib/capybara/poltergeist/server.rb