我试着连接到Google云IOT MQTT Brocker。我不允许将(5)作为异常连接到Java中。
device_id和其他细节是为云物联网中的设备设置的correct.The公钥。
使用下面的repo示例代码。example
发布于 2018-03-12 04:46:41
要查看的另一点是配置的GCP IoT核心云区域。
也有类似的问题。我将GCP IoT核心云区域配置为“asia-east1 1”,而在客户端应用程序端,它的默认云区域是“us-central1 1”。
如果云区域没有正确配置,python/NodeJS IoT核心示例(mqtt、http、end2end)将返回错误,如
Creating JWT using RS256 from private key file rsa_private.pem
Publishing message 1/100: 'test/test_1-payload-1'
('on_connect', 'Connection Refused: not authorised.')
('on_disconnect', '5: The connection was refused.')要解决这个问题,只需将正确的云区域参数传递给命令--cloud_region=asia-east1
示例:
python cloudiot_mqtt_example.py --project_id=project_id --registry_id=registry_id --device_id=device_id --private_key_file=rsa_private.pem --algorithm=RS256 --cloud_region=asia-east1发布于 2017-11-03 17:28:08
有几件事要检查:
1)您确定SSL密钥的格式与您注册的格式匹配吗?RS256和RS256和X509,等等?
2)您在mqtt客户端上设置了TLS并获取了Google根证书吗?
2a) >=TLS 1.2?
3)验证JWT有正确的'aud‘值(项目-id,而不是项目名称),是否有正确的问题和到期时间?
https://stackoverflow.com/questions/46708675
复制相似问题