@inlineCallbacks<EOL><INDENT>def connectToBroker(self, protocol):<DEDENT>
self.protocol                 = protocol<EOL>self.protocol.onPublish       = self.onPublish<EOL>self.protocol.onDisconnection = self.onDisconnection<EOL>self.protocol.setWindowSize(<NUM_LIT:3>) <EOL>try:<EOL><INDENT>yield self.protocol.connect("<STR_LIT>", keepalive=<NUM_LIT>)<EOL>yield self.subscribe()<EOL><DEDENT>except Exception as e:<EOL><INDENT>log.error("<STR_LIT>", <EOL>broker=BROKER, excp=e)<EOL><DEDENT>else:<EOL><INDENT>log.info("<STR_LIT>", broker=BROKER)<EOL><DEDENT>
Connect to MQTT broker