Sha256: 58883452c7c38396a1cec3ec7d13ff371c1cf95d1e289da52ff21f1cd0dd4118

Contents?: true

Size: 569 Bytes

Versions: 15

Compression:

Stored size: 569 Bytes

Contents

name 'udp responder'
always_start true

default[:host], default[:port] = Kurchatov::Config[:udp_responder].to_s.split(":")

run_if do
  !!Kurchatov::Config[:udp_responder]
end

helpers do
  def process(data, src)
    begin
      event(JSON.parse(data))
      src.reply "sended\n\n"
    rescue => e
      src.reply "failed to send: #{data.inspect}\n"
      Log.error("Failed parse #{data.inspect}, #{e.class}: #{e}\n #{e.backtrace.join("\n")}")
    end
  end
end

run do
  Socket.udp_server_loop(plugin.host, plugin.port) do |data, src|
    process(data, src)
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
kurchatov-0.2.0 lib/kurchatov/responders/udp.rb
kurchatov-0.1.8 lib/kurchatov/responders/udp.rb
kurchatov-0.1.7 lib/kurchatov/responders/udp.rb
kurchatov-0.1.6 lib/kurchatov/responders/udp.rb
kurchatov-0.1.5 lib/kurchatov/responders/udp.rb
kurchatov-0.1.4 lib/kurchatov/responders/udp.rb
kurchatov-0.1.3 lib/kurchatov/responders/udp.rb
kurchatov-0.1.2 lib/kurchatov/responders/udp.rb
kurchatov-0.1.1 lib/kurchatov/responders/udp.rb
kurchatov-0.1.0 lib/kurchatov/responders/udp.rb
kurchatov-0.0.9 lib/kurchatov/responders/udp.rb
kurchatov-0.0.8.pre.3 lib/kurchatov/responders/udp.rb
kurchatov-0.0.7.pre.4 lib/kurchatov/responders/udp.rb
kurchatov-0.0.8.pre.2 lib/kurchatov/responders/udp.rb
kurchatov-0.0.8.pre.1 lib/kurchatov/responders/udp.rb