Class: Tremolo::Sender

Inherits:
Object
  • Object
show all
Includes:
Celluloid::IO
Defined in:
lib/tremolo/sender.rb

Instance Method Summary collapse

Constructor Details

#initialize(host, port) ⇒ Sender

Returns a new instance of Sender.



6
7
8
9
# File 'lib/tremolo/sender.rb', line 6

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

Instance Method Details

#write_points(series_name, data) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/tremolo/sender.rb', line 11

def write_points(series_name, data)
  begin
    @socket.send(prepare(series_name, data), 0)
  rescue Errno::ECONNREFUSED => e
    # debug "Connection refused. Ignoring."
    nil
  end
end