Method: Fancybox2::Module::Base#setup

Defined in:
lib/fancybox2/module/base.rb

#setup(retry_connection = true) ⇒ Object



254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
# File 'lib/fancybox2/module/base.rb', line 254

def setup(retry_connection = true)
  unless @setted_up
    begin
      logger.debug 'Connecting to the broker...'
      mqtt_client.connect
    rescue PahoMqtt::Exception => e
      # :nocov:
      logger.error "Error while connecting to the broker: #{e.message}"
      retry if retry_connection
      # :nocov:
    end

    @setted_up = true
  end
end