espressif / esp-rainmaker

ESP RainMaker Agent for firmware development
Apache License 2.0
432 stars 145 forks source link

Use of websocket and webserver with esprainmaker ?? (MEGH-3991) #193

Closed b4sudhir closed 1 year ago

b4sudhir commented 1 year ago

I want to use websocket and webserver with esp rainmaker but getting error with websocket. Error : E (96462) esp-tls-mbedtls: mbedtls_ssl_setup returned -0x7F00 E (96463) esp-tls: create_ssl_handle failed E (96463) esp-tls: Failed to open new connection E (96465) TRANSPORT_BASE: Failed to open a new connection E (96472) MQTT_CLIENT: Error transport connect E (96474) esp_mqtt_glue: MQTT_EVENT_ERROR

sanketwadekar commented 1 year ago

Hi, This error is caused due to low memory available.

shahpiyushv commented 1 year ago

@b4sudhir , as @sanketwadekar mentioned, this error could be caused by memory issues, but can you clarify what exactly are you trying to do? The error I see here is for MQTT. Which webserver are you trying to connect to here?

b4sudhir commented 1 year ago

@sanketwadekar > Hi, This error is caused due to low memory available.

Details for free available memory with time stamp, just before device tried to make connection for MQTT.

11:12:21.085 -> Description Internal SPIRAM 11:12:21.085 -> Current Free Memory 146116 0 11:12:21.085 -> Largest Free Block 29684 0 11:12:21.085 -> Min. Ever Free Size 7248 0 11:12:21.647 -> E (175608) esp-tls-mbedtls: mbedtls_ssl_handshake returned -0x7680 11:12:21.647 -> E (175609) esp-tls: Failed to open new connection 11:12:21.647 -> E (175609) TRANSPORT_BASE: Failed to open a new connection 11:12:21.693 -> E (175617) MQTT_CLIENT: Error transport connect 11:12:21.693 -> E (175618) esp_mqtt_glue: MQTT_EVENT_ERROR

@shahpiyushv I am trying to add webserver with websocket. Libraray which i used is given below. I want to run local webserver on my device for offline use. First i tied to add webserver in which i didnt get any error, After that i tried with adding websocket in it and start getting error while connecting . In Mobile App also Confirming Node Association Failed.

And i an using this lib in my many projects with MQTT without any problem .

include //(DEFAULT)// Arduino15\packages\esp32\hardware\esp32\2.0.5\libraries\WebServer\src\WebServer.h

WebServer server(80); //LIBRARY FOR WEBSOCKETS

include //https://github.com/gilmaimon/ArduinoWebsockets

WebSocketsServer webSocket = WebSocketsServer(88);

b4sudhir commented 1 year ago

@shahpiyushv .If i remove websocket than my system work perfectly without issue . So it might conflict in library with websocket. Now i removed websocket from my project and using ajax ...My system is working flawlessly. Thanks for your support and guidance.

shahpiyushv commented 1 year ago

@b4sudhir , probably the websocket library is using more heap memory causing the low memory issues for MQTT. Anyways, closing this since it has been resolved.