Class: Meshchat::Network::Remote::Connection
- Inherits:
-
Object
- Object
- Meshchat::Network::Remote::Connection
- Defined in:
- lib/meshchat/network/remote/connection.rb
Instance Attribute Summary collapse
-
#_message_dispatcher ⇒ Object
readonly
Returns the value of attribute _message_dispatcher.
-
#_message_factory ⇒ Object
readonly
Returns the value of attribute _message_factory.
-
#_relay_pool ⇒ Object
readonly
Returns the value of attribute _relay_pool.
Instance Method Summary collapse
-
#initialize(dispatcher, message_factory) ⇒ Connection
constructor
A new instance of Connection.
- #payload_for(to, encrypted_message) ⇒ Object
- #send_message(node, encrypted_message) ⇒ Object
Constructor Details
#initialize(dispatcher, message_factory) ⇒ Connection
Returns a new instance of Connection.
9 10 11 12 13 |
# File 'lib/meshchat/network/remote/connection.rb', line 9 def initialize(dispatcher, ) @_message_factory = @_message_dispatcher = dispatcher @_relay_pool = RelayPool.new(dispatcher) end |
Instance Attribute Details
#_message_dispatcher ⇒ Object (readonly)
Returns the value of attribute _message_dispatcher.
6 7 8 |
# File 'lib/meshchat/network/remote/connection.rb', line 6 def @_message_dispatcher end |
#_message_factory ⇒ Object (readonly)
Returns the value of attribute _message_factory.
6 7 8 |
# File 'lib/meshchat/network/remote/connection.rb', line 6 def @_message_factory end |
#_relay_pool ⇒ Object (readonly)
Returns the value of attribute _relay_pool.
7 8 9 |
# File 'lib/meshchat/network/remote/connection.rb', line 7 def _relay_pool @_relay_pool end |
Instance Method Details
#payload_for(to, encrypted_message) ⇒ Object
23 24 25 |
# File 'lib/meshchat/network/remote/connection.rb', line 23 def payload_for(to, ) { to: to, message: } end |
#send_message(node, encrypted_message) ⇒ Object
15 16 17 18 19 |
# File 'lib/meshchat/network/remote/connection.rb', line 15 def (node, ) Debug.(node, _relay_pool) payload = payload_for(node.uid, ) _relay_pool.send_payload(payload) end |