Class: OMQ::Transport::UDP::RadioConnection
- Inherits:
-
Object
- Object
- OMQ::Transport::UDP::RadioConnection
- Defined in:
- lib/omq/transport/udp.rb
Overview
Outgoing UDP connection for RADIO sockets.
Intentionally does not implement #read_frame — this signals Routing::Radio to skip the group listener and use ANY_GROUPS.
Instance Method Summary collapse
-
#close ⇒ Object
Closes the underlying UDP socket.
-
#curve? ⇒ Boolean
Whether this connection uses CURVE encryption.
-
#flush ⇒ Object
No-op; UDP datagrams are sent immediately.
-
#initialize(socket, host, port) ⇒ RadioConnection
constructor
A new instance of RadioConnection.
-
#write_message(parts) ⇒ Object
(also: #send_message)
Encodes and sends a datagram.
Constructor Details
#initialize(socket, host, port) ⇒ RadioConnection
Returns a new instance of RadioConnection.
99 100 101 102 103 |
# File 'lib/omq/transport/udp.rb', line 99 def initialize(socket, host, port) @socket = socket @host = host @port = port end |
Instance Method Details
#close ⇒ Object
Closes the underlying UDP socket.
134 135 136 |
# File 'lib/omq/transport/udp.rb', line 134 def close @socket.close rescue nil end |
#curve? ⇒ Boolean
Whether this connection uses CURVE encryption.
128 129 130 |
# File 'lib/omq/transport/udp.rb', line 128 def curve? false end |
#flush ⇒ Object
No-op; UDP datagrams are sent immediately.
121 122 |
# File 'lib/omq/transport/udp.rb', line 121 def flush end |
#write_message(parts) ⇒ Object Also known as: send_message
Encodes and sends a datagram.
110 111 112 113 114 115 116 |
# File 'lib/omq/transport/udp.rb', line 110 def (parts) group, body = parts datagram = UDP.encode_datagram(group.to_s, body.to_s) @socket.send(datagram, 0, @host, @port) rescue Errno::ECONNREFUSED, Errno::ENETUNREACH # UDP fire-and-forget — drop silently end |