Method: Connection#initialize
- Defined in:
- lib/ulms_client.rb
#initialize(host:, port:, mode:, agent:, **kwargs) ⇒ Connection
Returns a new instance of Connection.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/ulms_client.rb', line 46 def initialize(host:, port:, mode:, agent:, **kwargs) @agent = agent @mode = mode @mqtt = MQTT::Client.new @mqtt.host = host @mqtt.port = port @mqtt.username = "v2::#{mode}" @mqtt.client_id = agent.to_s OPTIONS.each do |option| @mqtt.send("#{option}=", kwargs[option]) if kwargs[option] != nil end end |