emqx / NanoSDK

NanoSDK - MQTT 5.0-compliant SDK with QUIC support in NNG flavor
https://nanomq.io
MIT License
135 stars 41 forks source link

use quic example code to connect to mq over tcp fail #126

Open gavinshao111 opened 2 years ago

gavinshao111 commented 2 years ago

Describe the bug In quic demo, connect mq over tcp fail.

Expected behavior Connect successful.

Actual Behavior Connect fail.

To Reproduce

Environment Details

Additional context connect mqtt-tcp://10.192.8.158:1883 fail, but connect to mqtt-tcp://10.192.8.158:14567 successful, console output:

[panzhao@localhost quic]$ ./quic_client conn mqtt-tcp://10.192.8.158:1883 QUIC Stream closed, pipe finit! [Disconnected][CLIENT FOR QUIC]... ^C [panzhao@localhost quic]$ ./quic_client conn mqtt-tcp://10.192.8.158:14567 [Msg Sent][CLIENT FOR QUIC]... [Connected][CLIENT FOR QUIC]... ^C [panzhao@localhost quic]$ ./quic_client conn mqtt-quic://10.192.8.158:14567 [Msg Sent][CLIENT FOR QUIC]... [Connected][CLIENT FOR QUIC]...

JaylinYu commented 2 years ago

Seems like it still goes into QUIC transport layer. Need your client code to proceed

wanghaEMQ commented 2 years ago

Thanks for your issue.

In quic client. It seems that we do not check the scheme(mqtt-tcp or mqtt-quic) before it goes to quic transport layer. So you can connect to mqtt broker over quic (on 14567 port).

But quic client is NOT supported to connect to mqtt broker over tcp (on 1883 port) if you don't modify the codes therein.

We will fix the scheme check problem at later. And if you want to connect mqtt broker over tcp. You could use mqtt or mqtt_async example.

JaylinYu commented 2 years ago

nng_mqtt_quic_client_open doesn't check scheme now