This is a continuation of the ESP32 WebSocket Server video: https://www.youtube.com/watch?v=ZbX-l1Dl4N4. Let’s take it to the next level! We begin by hosting a web server and WebSocket server on an ESP32 using Arduino. Next, we use SPIFFS to upload a simple index.html page that we write separately. This page will open a WebSocket connection back to the ESP32, where we can use the page’s button to toggle an LED (relatively quickly).

Note that we use the ESP32 as an access point (AP) here to simplify the process. You can do away with the access point, if you wish to have the web server on your local network.

WebSockets provide a persistent connection between a client and server so that either party can send data at any time. They are very useful in things like networked video games, but they can also be applied to IoT devices, if we need fast control of hardware over a network.

Arduino and HTML code from the video can be found here: http://shawnhymel.com/1882/how-to-create-a-web-server-with-websockets-using-an-esp32-in-arduino/