Method: MQTT::Client.connect
- Defined in:
- lib/mqtt/client.rb
.connect(*args) ⇒ 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
115 116 117 118 119 |
# File 'lib/mqtt/client.rb', line 115 def self.connect(*args, &) client = MQTT::Client.new(*args) client.connect(&) client end |