Links2004 / arduinoWebSockets

arduinoWebSockets
GNU Lesser General Public License v2.1
1.85k stars 549 forks source link

ESP32 Async Mode #540

Open n9wxu opened 4 years ago

n9wxu commented 4 years ago

I would like to use the ESP32 in Async Mode with the websocket library. It appears that the trigger for this is NETWORK_ESP8266_ASYNC as further into that branch, there is a check for ESP32.

This is not clear to me and I would hate to put references to the ESP8266 in my ESP32 project. That will cause confusion to my future self.

Links2004 commented 4 years ago

does the ESP32 have a async backend? the lib is using ESPAsyncTCP for the ESP8266. if there is a equivalent for the ESP32, integrating a new Network option is possible. if the ESP32 lib shares the same API then the ESPAsyncTCP variant its easy, otherwise it requires some work.

n9wxu commented 4 years ago

Yes It is called AsyncTCP

Look here for an example: https://github.com/me-no-dev/ESPAsyncWebServer

petr-fiala commented 3 years ago

Yes It is called AsyncTCP

Look here for an example: https://github.com/me-no-dev/ESPAsyncWebServer

ESPAsyncWebServer implements only server side of webSockets. We also need client...

CelliesProjects commented 3 years ago

Yes It is called AsyncTCP

@n9wxu You copied a link to the server.

https://github.com/me-no-dev/AsyncTCP

@petr-fiala @Links2004 I am not sure if it is the exact same API but it shares a lot with ESPAsynTCP.

petr-fiala commented 3 years ago

@CelliesProjects i tried to use AsyncTCP with arduinoWebSockets on esp32, i managed to integrate it, but it was crashing like crazy, every 1 - 5 second esp32 restarted.. my guess is that there is too may dynamic allocations, after few seconds i always ended up with f*cked up (fragmented) memory which causes esp32 restart. I also tryed to fix it, remove as many dynamic allocations as i could but i wasnt successful.

I'm using arduinoWebSockets for realtime video transfer between two esp32s, so any leaks or significant memory fragmentation will make it crash in a few seconds. @Links2004 should try to integrate AsyncTCP, it would be absolutely awesome to have async arduinoWebSockets for esp32.

yangminglong commented 1 year ago

@Links2004

lucasalberto01 commented 4 months ago

+1