-
Notifications
You must be signed in to change notification settings - Fork 265
mqtt: allow using external TCP transport handles (IDFGH-10290) #260
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Hi @huming2207, I have a similar internal PR that provides the same feature. We differ in 2 aspects mainly:
I'm attaching the patch with the modifications, so you can take a look. |
Yea this is a great idea, I really want to implement something like KCP on ESP32 without my current dirty hacks!
Yep, but I think the user may consider managing the lifecycle of the external TCP transport. One use case for us is like:
We haven't implemented all of these features above. But eventually when our project goes well, we wish the proxy connection stays connected as long as possible. Otherwise we may end up millions of devices DDoS'ing our proxy server by opening up the socket and closing it soon after. It also wastes more power and generate more e-waste on our primary battery powered ESP32 devices. Regards, |
@euripedesrocha Another scenario is the NB-IoT network. Unlike Mainland China, the NB-IoT services here in Australia is extremely expensive with a lot of bureaucracy matters we don't want to deal with. We have to try saving the data much as possible. If we have to use an HTTPS proxy via a particular NB network, and because we have no control on the proxy transport, we then have to redo the HTTPS proxy's TLS handshake more often. We will waste a few KB data on each handshake, and we will be charged a lot by the ISP. |
@huming2207 thanks for the information! Regarding the lifetime, the client
The Even if we keep the call to destroy, you could provide an empty destroy function on your custom transport implementation. |
Hmm yea, I also evaluated a bit further. I think we can control the lifecycle manually by adding some custom dirty hacks in the destroy callback function and config structs. Considering it's more beginner-friendly and less likely to cause memory leaks in generic scenarios, destroying the transport handle by the client is probably better. |
Hi @huming2207, we just merged our version of this feature, can you take a look if it solves your issue? |
Ah, thanks! I think it's working. I will close this pull request for now. |
Hi there,
This PR is to add support for external TCP transport handles, e.g. the SOCKS proxy, or my HTTP/HTTPS proxy.
See here for more details: espressif/esp-idf#10684
Regards,
Jackson