Class: Linr::Connection::UDP

Inherits:
Object
  • Object
show all
Defined in:
lib/linr/connection/udp.rb

Overview

Connects to a InfluxDB UDP port

Examples:

UDP.new("localhost", 8089).send("series a=0.51")

See Also:

Constant Summary collapse

SEND_FLAGS =

Use non-custom flags

0

Instance Method Summary collapse

Constructor Details

#initialize(host, port) ⇒ UDP

Establishes a connection


16
17
18
19
# File 'lib/linr/connection/udp.rb', line 16

def initialize(host, port)
  @socket = UDPSocket.new
  @socket.connect(host, port)
end

Instance Method Details

#send(data) ⇒ Object

Send data over the UDP connection. Should be encoded using the Line Protocol.

See Also:


25
26
27
# File 'lib/linr/connection/udp.rb', line 25

def send(data)
  @socket.send(data, SEND_FLAGS)
end