Class: Pvectl::Console::TerminalSession::SocketAdapter Private

Inherits:
Object
  • Object
show all
Defined in:
lib/pvectl/console/terminal_session.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Minimal adapter satisfying websocket-driver’s socket interface.

The driver calls #url to build the HTTP upgrade request and #write to send framed data over the wire.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url, socket) ⇒ SocketAdapter

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Creates a new socket adapter.

Parameters:

  • url (String)

    WebSocket URL

  • socket (TCPSocket, OpenSSL::SSL::SSLSocket)

    underlying socket



433
434
435
436
# File 'lib/pvectl/console/terminal_session.rb', line 433

def initialize(url, socket)
  @url = url
  @socket = socket
end

Instance Attribute Details

#urlString (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns the WebSocket URL.

Returns:

  • (String)

    the WebSocket URL



426
427
428
# File 'lib/pvectl/console/terminal_session.rb', line 426

def url
  @url
end

Instance Method Details

#write(data) ⇒ Integer

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Writes data to the underlying socket.

Parameters:

  • data (String)

    raw bytes to send

Returns:

  • (Integer)

    number of bytes written



443
444
445
# File 'lib/pvectl/console/terminal_session.rb', line 443

def write(data)
  @socket.write(data)
end