Class: InfluxDB::UDPClient

Inherits:
Object
  • Object
show all
Defined in:
lib/influxdb/udp_client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#socketObject

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