Class: ChromeRemote::WebSocketClient
- Inherits:
-
Object
- Object
- ChromeRemote::WebSocketClient
- Defined in:
- lib/chrome_remote/web_socket_client.rb
Instance Attribute Summary collapse
-
#driver ⇒ Object
readonly
Returns the value of attribute driver.
-
#messages ⇒ Object
readonly
Returns the value of attribute messages.
-
#socket ⇒ Object
readonly
Returns the value of attribute socket.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(url) ⇒ WebSocketClient
constructor
A new instance of WebSocketClient.
- #read_msg ⇒ Object
- #send_msg(msg) ⇒ Object
Constructor Details
#initialize(url) ⇒ WebSocketClient
Returns a new instance of WebSocketClient.
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/chrome_remote/web_socket_client.rb', line 8 def initialize(url) @socket = ChromeRemote::Socket.new(url) @driver = ::WebSocket::Driver.client(socket) @messages = [] @status = :closed setup_driver start_driver end |
Instance Attribute Details
#driver ⇒ Object (readonly)
Returns the value of attribute driver.
6 7 8 |
# File 'lib/chrome_remote/web_socket_client.rb', line 6 def driver @driver end |
#messages ⇒ Object (readonly)
Returns the value of attribute messages.
6 7 8 |
# File 'lib/chrome_remote/web_socket_client.rb', line 6 def @messages end |
#socket ⇒ Object (readonly)
Returns the value of attribute socket.
6 7 8 |
# File 'lib/chrome_remote/web_socket_client.rb', line 6 def socket @socket end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
6 7 8 |
# File 'lib/chrome_remote/web_socket_client.rb', line 6 def status @status end |
Instance Method Details
#read_msg ⇒ Object
23 24 25 26 |
# File 'lib/chrome_remote/web_socket_client.rb', line 23 def read_msg parse_input until msg = .shift msg end |
#send_msg(msg) ⇒ Object
19 20 21 |
# File 'lib/chrome_remote/web_socket_client.rb', line 19 def send_msg(msg) driver.text msg end |