擅长:python、mysql、java
<p>来自<a href="http://docs.aws.amazon.com/iot/latest/developerguide/protocols.html" rel="nofollow noreferrer">http://docs.aws.amazon.com/iot/latest/developerguide/protocols.html</a></p>
<blockquote>
<p>The message broker uses the client ID to identify each client. The client ID is passed in from the client to the message broker as part of the MQTT payload. Two clients with the same client ID are not allowed to be connected concurrently to the message broker. When a client connects to the message broker using a client ID that another client is using, a CONNACK message will be sent to both clients >and the currently connected client will be disconnected.</p>
</blockquote>
<p>必须为每个客户端传入一个唯一的字符串到AWSIoTMQTTClient()或一个空字符串。如果您为客户端id传递一个空字符串,AWS IoT网关将在连接时为您分配一个随机的客户端id。在</p>
<p>将AWSIoTMQTTClient调用从</p>
<pre><code>my_rpi = AWSIoTMQTTClient("basicPubSub")
</code></pre>
<p>到</p>
^{pr2}$
<p>在连接时,每个rpi都将被分配一个唯一的随机客户机id。AWS不建议在规模上这样做,但对于测试来说这是可以的。您还将失去在策略中使用clientid的能力。在</p>