class Staccato::Adapter::UDP

Public Class Methods

new(uri) click to toggle source

Takes a URI with host/port

e.g.: URI('udp://127.0.0.1:3001')
# File lib/staccato/adapter/udp.rb, line 9
def initialize(uri)
  @host = uri.host
  @port = uri.port

  @socket = UDPSocket.new
end

Public Instance Methods

post(params) click to toggle source
# File lib/staccato/adapter/udp.rb, line 16
def post(params)
  body = URI.encode_www_form(params)

  @socket.send(body, 0, @host, @port)
end