Class: OMQ::Transport::UDP::Dialer
- Inherits:
-
Object
- Object
- OMQ::Transport::UDP::Dialer
- Defined in:
- lib/omq/transport/udp.rb
Overview
A UDP dialer — registers a single RadioConnection with the engine.
UDP is connectionless; #connect is a one-shot registration. The reconnect loop will break out after the first successful call.
Instance Attribute Summary collapse
-
#endpoint ⇒ String
readonly
The endpoint this dialer sends to.
Instance Method Summary collapse
-
#connect ⇒ void
Registers a RadioConnection with the engine.
-
#initialize(endpoint, engine) ⇒ Dialer
constructor
A new instance of Dialer.
Constructor Details
#initialize(endpoint, engine) ⇒ Dialer
Returns a new instance of Dialer.
103 104 105 106 |
# File 'lib/omq/transport/udp.rb', line 103 def initialize(endpoint, engine) @endpoint = endpoint @engine = engine end |
Instance Attribute Details
#endpoint ⇒ String (readonly)
Returns the endpoint this dialer sends to.
97 98 99 |
# File 'lib/omq/transport/udp.rb', line 97 def endpoint @endpoint end |
Instance Method Details
#connect ⇒ void
This method returns an undefined value.
Registers a RadioConnection with the engine.
113 114 115 116 117 118 |
# File 'lib/omq/transport/udp.rb', line 113 def connect host, port = UDP.parse_endpoint(@endpoint) socket = UDPSocket.new conn = RadioConnection.new(socket, host, port) @engine.connection_ready(conn, endpoint: @endpoint) end |