Module: Fix::Engine::ClientConnection

Includes:
Connection
Defined in:
lib/fix/engine/client_connection.rb

Overview

The client connection wrapper, used in order to connect a remote FIX server

Constant Summary

Constants included from Connection

Fix::Engine::Connection::TEST_REQ_GRACE_TIME

Instance Attribute Summary collapse

Attributes included from Connection

#comp_id, #hrtbt_int, #ip, #last_request_at, #msg_buf, #port, #target_comp_id

Instance Method Summary collapse

Methods included from Connection

#keep_alive, #kill!, #peer, #peer_error, #process_msg, #receive_data, #run_message_handler, #send_heartbeat, #send_msg, #send_test_request, #set_heartbeat_interval, #unbind

Methods included from Logger

#log, log, logger

Instance Attribute Details

#usernameObject

Returns the value of attribute username.



13
14
15
# File 'lib/fix/engine/client_connection.rb', line 13

def username
  @username
end

Instance Method Details

#on_logon(msg) ⇒ Object

Consider ourselves logged-in if we receive on of these



43
44
45
# File 'lib/fix/engine/client_connection.rb', line 43

def on_logon(msg)
  @logged_in = true
end

#post_initObject

Run after we’ve connected to the server



18
19
20
21
22
23
24
25
26
# File 'lib/fix/engine/client_connection.rb', line 18

def post_init
  super

  log("Connecting to server sending a logon message with our COMP_ID <#{@comp_id}>")

  @logged_in = false

  EM.next_tick { send_logon }
end

#send_logonObject

Sends a logon message to the server we’re connected to



31
32
33
34
35
36
37
38
# File 'lib/fix/engine/client_connection.rb', line 31

def send_logon
  logon = FP::Messages::Logon.new
  logon.username            = @username
  logon.target_comp_id      = @peer_comp_id
  logon.sender_comp_id      = @comp_id 
  logon.reset_seq_num_flag  = true
  send_msg(logon)
end