Sha256: 31ac7fa92d80a3865a1d1df27744bcaeb4acf1f29bfa28902cc49ceb5ac8ea37

Contents?: true

Size: 462 Bytes

Versions: 1

Compression:

Stored size: 462 Bytes

Contents

#!/usr/bin/env ruby

$:.unshift File.dirname(__FILE__)+'/../lib'

require 'mqtt/proxy'

proxy = MQTT::Proxy.new(
    :local_host => '0.0.0.0',
    :local_port => 1883,
    :broker_host => 'mqtt.example.com',
    :broker_port => 1883
)

proxy.client_filter = lambda { |packet|
  puts "From client: #{packet.inspect}"
  return packet
}

proxy.broker_filter = lambda { |packet|
  puts "From broker: #{packet.inspect}"
  return packet
}

# Start the proxy
proxy.run

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mqtt-0.0.4 examples/readonly_proxy.rb