我正在尝试使用此链接中提到的 Python 脚本设置 AWS IoT :
我可以在没有 WebSocket 的情况下连接 AWS IoT MQTT(使用 x.509 证书)。
# creates the AWS IoT
def createIoT():
iot = AWSIoTMQTTShadowClient('AWSHome')
# update this with your own endpoint from the IOT dashboard
iot.configureEndpoint('allj.iot.reg.amazonaws.com', 443)
iot.configureCredentials('rootCA','private.key','certificate.crt')
iot.configureConnectDisconnectTimeout(10) # 10 sec
iot.configureMQTTOperationTimeout(5) # 5 sec
iot.connect()
return
但是当我尝试使用 WebSocket 连接 AWS IoT MQTT 时,出现以下错误:
使用通过运行此命令生成的证书:wget
# creates the AWS IoT
def createIoT():
iot = AWSIoTMQTTShadowClient('AWSHome')
# update this with your own endpoint from the IOT dashboard
iot.configureEndpoint('asdasd.reg.amazonaws.com', 443)
iot.configureCredentials('VeriSign-Class%203-Public-Primary-Certification-Authority-G5.pem')
iot.configureConnectDisconnectTimeout(10) # 10 sec
iot.configureMQTTOperationTimeout(5) # 5 sec
iot.connect()
return
相关分类