【以下的问题经过翻译处理】 我编写了一个简单的IoT Core客户端,尝试使用基本摄取来推送消息。客户端是用go编写的。它能够连接成功,但是当我尝试发送消息时,我遇到了以下问题:
{
"timestamp": "2022-11-14 21:56:42.078",
"logLevel": "ERROR",
"traceId": "22dd3237-1e62-6fde-fd45-d796ca4e4a2b",
"accountId": "xxxx",
"status": "Failure",
"eventType": "Publish-In",
"protocol": "MQTT",
"topicName": "$aws/rules/stat",
"clientId": "washnet-test-1",
"principalId": "xxxx",
"sourceIp": "xxx.xxx.xxx.xxx",
"sourcePort": 47410
}
我不确定这意味着什么。该代码使用MQTT版本3.1.1和QOS级别0进行发布。
status := StatusMessage{
Status: "OK",
}
payload, err := json.Marshal(status)
if err != nil {
panic(err)
}
token := mqttClient.Publish("$aws/rules/stat", byte(0), true, payload)
token.Wait()
这是使用[客户端v1.4.2](github.com/eclipse/paho.mqtt.golang)的情况。客户端响应:
[DEBUG] [client] enter Publish
[DEBUG] [client] sending publish message, topic: $aws/rules/stat
[DEBUG] [net] obound msg to write 0
[DEBUG] [net] obound wrote msg, id: 0
[DEBUG] [net] outgoing waiting for an outbound message
2022/11/14 16:56:42 [OK] Message sent
2022/11/14 16:56:42 Sleeping
[DEBUG] [net] incoming complete
[DEBUG] [net] startIncomingComms: got msg on ibound
[DEBUG] [net] logic waiting for msg on ibound
[DEBUG] [net] startIncomingComms: ibound complete
[DEBUG] [net] startIncomingComms goroutine complete
[DEBUG] [net] outgoing waiting for an outbound message
[ERROR] [client] Connect comms goroutine - error triggered EOF
[DEBUG] [client] internalConnLost called