Links2004 / arduinoWebSockets

arduinoWebSockets
GNU Lesser General Public License v2.1
1.9k stars 555 forks source link

AsyncTCP Example #78

Closed ccostel closed 8 years ago

ccostel commented 8 years ago

Hey Links2004,

Thank you very much for this awesome library. I am intending to use is to control my electric skateboard.

The issue is that with the sync websocket server I seem to have freezings when sending the data and I would like to try out the Async TCP but I cannot seem to understand how to set it up.

Could you show me a short example of how the websocket events are handled in the loop() function?

Links2004 commented 8 years ago

the code is the same then for the Sync version. only add the include for the ESPAsyncTCP lib (https://github.com/me-no-dev/ESPAsyncTCP) and change the settings to async here: https://github.com/Links2004/arduinoWebSockets/blob/master/src/WebSockets.h#L57-L58

you can remove the webSocket.loop(); call if you like since its a empty dummy function in async mode.