Method: MQTT::Client.connect
- Defined in:
- lib/mqtt/client.rb
.connect(*args, &block) ⇒ Object
Create and connect a new MQTT Client
Accepts the same arguments as creating a new client. If a block is given, then it will be executed before disconnecting again.
Example:
MQTT::Client.connect('myserver.example.com') do |client|
# do stuff here
end
98 99 100 101 102 |
# File 'lib/mqtt/client.rb', line 98 def self.connect(*args, &block) client = MQTT::Client.new(*args) client.connect(&block) client end |