Class: InfluxDB::UDPClient
- Inherits:
-
Object
- Object
- InfluxDB::UDPClient
- Defined in:
- lib/influxdb/udp_client.rb
Instance Attribute Summary collapse
-
#socket ⇒ Object
Returns the value of attribute socket.
Instance Method Summary collapse
-
#initialize(host, port) ⇒ UDPClient
constructor
A new instance of UDPClient.
- #send(payload) ⇒ Object
Constructor Details
#initialize(host, port) ⇒ UDPClient
Returns a new instance of UDPClient.
6 7 8 9 |
# File 'lib/influxdb/udp_client.rb', line 6 def initialize(host, port) self.socket = UDPSocket.new self.socket.connect(host, port) end |
Instance Attribute Details
#socket ⇒ Object
Returns the value of attribute socket.
5 6 7 |
# File 'lib/influxdb/udp_client.rb', line 5 def socket @socket end |
Instance Method Details
#send(payload) ⇒ Object
11 12 13 14 |
# File 'lib/influxdb/udp_client.rb', line 11 def send(payload) socket.send(JSON.generate(payload), 0) rescue end |