Class: Contrast::Api::Communication::SocketClient

Inherits:
Object
  • Object
show all
Includes:
Components::Interface
Defined in:
lib/contrast/api/communication/socket_client.rb

Overview

SocketClient acts as a interface between the agent and the service. It instantiates a service proxy and tracks the state of that proxy.

Instance Method Summary collapse

Methods included from Components::Interface

included

Constructor Details

#initializeSocketClient

Returns a new instance of SocketClient.



20
21
22
# File 'lib/contrast/api/communication/socket_client.rb', line 20

def initialize
  @socket = init_connection
end

Instance Method Details

#send_one(event) ⇒ Object

Wrap the given DTM in a Contrast::Api::Dtm::Message and send it to the Service for processing

Parameters:

  • event (Contrast::Api::Dtm)

    One of the DTMs valid for the event field of Contrast::Api::Dtm::Message



29
30
31
32
# File 'lib/contrast/api/communication/socket_client.rb', line 29

def send_one event
  msg = Contrast::Api::Dtm::Message.build(event)
  send_message(msg)
end