class KRPC::StreamConnection

TCP connection for streaming.

Attributes

rpc_connection[R]

Public Class Methods

new(rpc_connection, host = DEFAULT_SERVER_HOST, port = DEFAULT_SERVER_STREAM_PORT) click to toggle source
Calls superclass method KRPC::Connection::new
# File lib/krpc/connection.rb, line 113
def initialize(rpc_connection, host = DEFAULT_SERVER_HOST, port = DEFAULT_SERVER_STREAM_PORT)
  super host, port
  @rpc_connection = rpc_connection
end

Public Instance Methods

handshake() click to toggle source

Perform handshake with kRPC server, sending client_id retrieved from rpc_connection.

# File lib/krpc/connection.rb, line 119
def handshake
  raise(ConnectionError, "RPC connection must obtain client_id before stream connection can perform valid handshake - closing stream connection") if rpc_connection.client_id.nil?
  protobuf_handshake(:STREAM, client_identifier: rpc_connection.client_id)
end