esp-azure icon indicating copy to clipboard operation
esp-azure copied to clipboard

MQTT over websocket not compiling (CA-24)

Open liudr opened this issue 5 years ago • 10 comments

If I enable the SAMPLE_MQTT_OVER_WEBSOCKETS option, the device twin sample code fails to compile:

C:/Users/user/Downloads/msys32/home/user/esp/esp-azure/examples/iothub_devicetwin_samples_and_methods/build/main\libmain.a(iothub_client_device_twin_and_methods_sample.o):(.literal.iothub_client_device_twin_and_methods_sample_run+0x4): undefined reference to `MQTT_WebSocket_Protocol' collect2.exe: error: ld returned 1 exit status make: *** [C:/Users/user/Downloads/msys32/home/qk9446me/esp/esp-idf/make/project.mk:483: /home/user/esp/esp-azure/examples/iothub_devicetwin_samples_and_methods/build/iothub_devicetwin_samples_and_methods.elf] Error 1

Seems like this protocol is not found. What am I missing? Thanks.

liudr avatar Oct 03 '19 16:10 liudr

@liudr , even I tried giving this a shot, trying to fix some compilation issues, but there seem to be quite some dependencies. We may take this up later.

shahpiyushv avatar Oct 18 '19 14:10 shahpiyushv

@shahpiyushv , It's really a problem for us to be stuck to a classical MQTT connection to port 8883. Some corporate firewalls and home routers could block outbound traffic on "specific" ports. It would be a true relief to be able to use MQTT over WebSocket (with output port : 443). Do you have any plan to addd support of MQTT over WebSocket soon? Thanks!!

acheve avatar Oct 22 '19 10:10 acheve

@shahpiyushv For us this is also a huge problem as in many customer installations port 8883 is blocked. In countries such as Switzerland most ISPs have blocked this port by default and charge for opening it. Thus MQTT over websocket is an essential feature for us.

If the problem is not going to be solved in esp-azure port we need to look for alternatives. Talking about 20k of ESP32 per annum. Can you give an estimation of when MQTT over websockets is going to be implemented by Espressif?

daniel-grabner avatar Jan 16 '20 12:01 daniel-grabner

Any update on the possibility of MQTT_OVER_WEBSOCKETS? Thanks.

liudr avatar Apr 14 '20 23:04 liudr

Any update on the possibility of MQTT_OVER_WEBSOCKETS? Thanks.

+1 Urgently waiting for it too.

daniel-grabner avatar Apr 15 '20 12:04 daniel-grabner

+1 Would be great to have that feature here too, since many firewalls in various locations block the standard mqtt port per default and need to be opened then by a sysadmin if IoT Devices would like to operate there with the ESP azure sdk

Adamantinu avatar Apr 16 '20 08:04 Adamantinu

Fixing issue described in https://github.com/espressif/esp-azure/issues/90 and adding:

const IO_INTERFACE_DESCRIPTION* socketio_get_interface_description(void) { return wsio_get_interface_description(); }

to platform code fixes compilation, and allows MQTT over WebSocket.

MartinTJDK avatar Jul 02 '20 12:07 MartinTJDK

const IO_INTERFACE_DESCRIPTION* socketio_get_interface_description(void) { return wsio_get_interface_description(); }

And #include "azure_c_shared_utility/wsio.h" ?

Still have the error "undefined reference to `Prov_Device_MQTT_WS_Protocol'" even with the esp-idf from today...

Lisa999 avatar Aug 14 '20 22:08 Lisa999

MQTT over WebSocket now works on my cloned repo. Please see Pull request #68, which now includes "Upload to Blob" and "MQTT over WebSocket" features.

giroudon avatar Sep 11 '20 14:09 giroudon

MQTT over websockets works for me when following @MartinTJDK's instructions and adding some files to port/CMakeLists.txt:

"${AZURE_IOT_SDK}/iothub_client/src/iothubtransportmqtt_websockets.c"
"${AZURE_IOT_SDK}/c-utility/src/gb_rand.c"
"${AZURE_IOT_SDK}/c-utility/src/utf8_checker.c"
"${AZURE_IOT_SDK}/c-utility/src/uws_client.c"
"${AZURE_IOT_SDK}/c-utility/src/uws_frame_encoder.c"
"${AZURE_IOT_SDK}/c-utility/src/wsio.c"

Is there a reason these files are absent and am I supposed to add them somewhere else?

jspngh avatar Jan 18 '21 08:01 jspngh