Modern web application need realtime update, for year we use polling system with REST call but now we can't ignore WebSocket.
Here the sample web application served with an esp8266 with three layer: REST server, Web server and WebSocket, all managed with a token based authentication.
https://www.mischianti.org/category/t...