Paho MQTT 增长协议
Paho MQTT Golang Protocol
我是 Golang 和 mqtt 的新手。
我正在尝试连接到经纪人。它在我使用 MQTT.fx 或我的终端有蚊子时有效。
但是在我的程序中,我使用地址和 clientID 创建了我的选项,当我尝试连接时出现错误“Unknow protocol”
panic: Network Error : Unknown protocol
goroutine 1 [running]:
panic(0x347b20, 0xc820072fe0)
/usr/local/go/src/runtime/panic.go:481 +0x3e6
main.main()
test.go:29 +0x1cd
我在 MQTT.fx 上检查了协议版本,它是 TLSv1.2。
Paho 库支持 TLS 协议。我有点困惑
有人遇到同样的问题吗?
干杯
我修好了。只是忘了在 url.
开头精确说明协议
The type of connection required is specified by the scheme of the connection URL set in the ClientOptions struct, for example:
tcp://iot.eclipse.org:1883 - connect to iot.eclipse.org on port 1883 using plain TCP
ws://iot.eclipse.org:1883 - connect to iot.eclipse.org on port 1883 using WebSockets
tls://iot.eclipse.org:8883 - connect to iot.eclipse.org on port 8883 using TLS (ssl:// and tcps:// are synonyms for tls://)
有效:-)
我是 Golang 和 mqtt 的新手。
我正在尝试连接到经纪人。它在我使用 MQTT.fx 或我的终端有蚊子时有效。
但是在我的程序中,我使用地址和 clientID 创建了我的选项,当我尝试连接时出现错误“Unknow protocol”
panic: Network Error : Unknown protocol
goroutine 1 [running]:
panic(0x347b20, 0xc820072fe0)
/usr/local/go/src/runtime/panic.go:481 +0x3e6
main.main()
test.go:29 +0x1cd
我在 MQTT.fx 上检查了协议版本,它是 TLSv1.2。
Paho 库支持 TLS 协议。我有点困惑
有人遇到同样的问题吗?
干杯
我修好了。只是忘了在 url.
开头精确说明协议The type of connection required is specified by the scheme of the connection URL set in the ClientOptions struct, for example:
tcp://iot.eclipse.org:1883 - connect to iot.eclipse.org on port 1883 using plain TCP ws://iot.eclipse.org:1883 - connect to iot.eclipse.org on port 1883 using WebSockets tls://iot.eclipse.org:8883 - connect to iot.eclipse.org on port 8883 using TLS (ssl:// and tcps:// are synonyms for tls://)
有效:-)