Class: LanGrove::Client::Base

Inherits:
EventMachine::Connection
  • Object
show all
Defined in:
lib/langrove/client_base.rb

Direct Known Subclasses

Datagram

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#configObject

Returns the value of attribute config.



35
36
37
# File 'lib/langrove/client_base.rb', line 35

def config
  @config
end

#handlerObject

The handler collection specified in config is bound to this attribute after connect.



33
34
35
# File 'lib/langrove/client_base.rb', line 33

def handler
  @handler
end

#protocolObject

Returns the value of attribute protocol.



34
35
36
# File 'lib/langrove/client_base.rb', line 34

def protocol
  @protocol
end

Instance Method Details

#receive(decoded_data) ⇒ Object

Data arriving through the Adaptor is passed through the config assigned protocol and then arrives here in whatever format the <Protocol>.decode() method returned.



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/langrove/client_base.rb', line 44

def receive( decoded_data ) 

  #
  # OVERRIDE
  # 
  #   - Inbound data arrived at the adaptor
  #
  #   - It has passed through the protocol as
  #     defined in config.
  #
  #     The protocol arranged the data into 
  #     a Hash of: 
  #  
  #       - key and value pairs
  # 
  #       - key and more_complicated_thing pairs.
  # 
  #   - The decoded data was then passed into
  #     this function.
  #
  # 

end

#receive_data(data) ⇒ Object



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/langrove/client_base.rb', line 68

def receive_data( data )

  #
  # Note: The protocol currently lives on the Handler
  #       
  #       It MIG(  ...in progress...  )HT move,
  # 
  #       To a separate instance of the protocol object
  #       residing in each Client::ClientType instance 
  #       in the Handler::Base.client collection.
  # 
  #       Pending examining the logical barrier of having 
  #       the Handler route to the Cleint per a key value 
  #       extracted from the decoded data - as decoded by 
  #       the client's instance of the protocol not yet 
  #       accessable within the as yet undeterminable 
  #       instance in the Handlers collection.
  # 
  #       Catch22(ish)
  # 
  #       But that was suitable as a pettern for the 
  #       datagram server.
  # 
  #       Perhaps after implementing Adapter::TcpServer
  # 
  #       And gaining a more knowsome notion of the 
  #       intricacies of the application layer, esp
  #       ACKing and NAKing. 
  # 
  #       Then the possibilities of the Client::ClientType
  #       being a decendant of <self> --
  # 
  #       ie. The EM::Connection as instanciated upon each
  #           socket connect.
  #
  #       -- will likely resolve.
  #
  # 
  receive( @protocol.decode( data ) )
  
end