In this article I present how to host a web app on your Raspberry Pi (or other computers) with a couple of interesting features.
- ⛔ no static IP address, Dynamic DNS or port forwarding on your router needed
- 🚀 low latency access over the public Internet without server in the middle
- 🔁 possibility to easily share access to that web app only to specific people
The web app will consist of two elements:
- ✏️ front-end: using Bootstrap 4 and websocket client written in JS
- ✏️ back-end: Python app with a websocket server providing a JSON API to the front-end part
I show a bi-directional connection over a single websocket. The demo application will be very simple - controlling a LED connected to Raspberry Pi using a button in web UI and controlling an indicator in the web UI over the button connected to Raspberry Pi.
💭 You can treat this app as a boilerplate code for your own, more sophisticated apps requiring a low-latency control over a web user interface.