lib/mqtt/proxy.rb in mqtt-0.1.0 vs lib/mqtt/proxy.rb in mqtt-0.2.0
- old
+ new
@@ -1,13 +1,23 @@
# Class for implementing a proxy to filter/mangle MQTT packets.
class MQTT::Proxy
+ # Address to bind listening socket to
attr_reader :local_host
+
+ # Port to bind listening socket to
attr_reader :local_port
+
+ # Address of upstream broker to send packets upstream to
attr_reader :broker_host
+
+ # Port of upstream broker to send packets upstream to.
attr_reader :broker_port
- attr_reader :listen_queue
+
+ # Time in seconds before disconnecting an idle connection
attr_reader :select_timeout
+
+ # Ruby Logger object to send informational messages to
attr_reader :logger
# Create a new MQTT Proxy instance.
#
# Possible argument keys:
@@ -21,10 +31,10 @@
#
# NOTE: be careful not to connect to yourself!
def initialize(args={})
@local_host = args[:local_host] || '0.0.0.0'
@local_port = args[:local_port] || MQTT::DEFAULT_PORT
- @broker_host = args[:broker_host] || MQTT::DEFAULT_HOST
+ @broker_host = args[:broker_host]
@broker_port = args[:broker_port] || 18830
@select_timeout = args[:select_timeout] || 60
# Setup a logger
@logger = args[:logger]