class Playwright::WebSocketClient::DriverImpl

Attributes

url[R]

Public Class Methods

new(url) click to toggle source
# File lib/playwright/web_socket_client.rb, line 27
def initialize(url)
  @url = url

  endpoint = URI.parse(url)
  @socket =
    if endpoint.scheme == 'wss'
      SecureSocketFactory.new(endpoint.host, endpoint.port).create
    else
      TCPSocket.new(endpoint.host, endpoint.port)
    end
end

Public Instance Methods

disconnect() click to toggle source
# File lib/playwright/web_socket_client.rb, line 55
def disconnect
  @socket.close
end
readpartial(maxlen = 1024) click to toggle source
# File lib/playwright/web_socket_client.rb, line 49
def readpartial(maxlen = 1024)
  @socket.readpartial(maxlen)
rescue Errno::ECONNRESET
  raise EOFError.new('closed by remote')
end
write(data) click to toggle source
# File lib/playwright/web_socket_client.rb, line 41
def write(data)
  @socket.write(data)
rescue Errno::EPIPE
  raise EOFError.new('already closed')
rescue Errno::ECONNRESET
  raise EOFError.new('closed by remote')
end