module ChromeRemote

Constants

DEFAULT_OPTIONS
VERSION

Public Class Methods

client(options = {}) click to toggle source
# File lib/chrome_remote.rb, line 13
def client(options = {})
  options = DEFAULT_OPTIONS.merge(options)

  Client.new(get_ws_url(options))
end

Private Class Methods

get_ws_url(options) click to toggle source
# File lib/chrome_remote.rb, line 21
def get_ws_url(options)
  response = Net::HTTP.get(options[:host], "/json", options[:port])
  # TODO handle unsuccesful request
  response = JSON.parse(response)

  first_page = response.find {|e| e["type"] == "page"} 
  # TODO handle no entry found
  first_page["webSocketDebuggerUrl"]
end