espressif / esp-azure

SDK to connect ESP8266 and ESP32 to Microsoft Azure IoT services
177 stars 93 forks source link

MQTT over websocket not compiling (CA-24) #62

Open liudr opened 5 years ago

liudr commented 5 years ago

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.

shahpiyushv commented 5 years ago

@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.

acheve commented 5 years ago

@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!!

daniel-grabner commented 4 years ago

@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?

liudr commented 4 years ago

Any update on the possibility of MQTT_OVER_WEBSOCKETS? Thanks.

daniel-grabner commented 4 years ago

Any update on the possibility of MQTT_OVER_WEBSOCKETS? Thanks.

+1 Urgently waiting for it too.

Adamantinu commented 4 years ago

+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

MartinTJDK commented 4 years ago

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.

Lisa999 commented 4 years ago

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...

giroudon commented 4 years ago

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.

jspngh commented 3 years ago

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?