-
Notifications
You must be signed in to change notification settings - Fork 3
100 The web site
To work properly, a web site is needed, especially as long as there is no mobile application yet (it's a project).
Its purpose is multiple:
- host the webApp files
- host a master module registration mechanism to easily find a master iotinator connected on the same network as your mobile phone (see autodiscovery below)
- host a database to store statistics and logs for agents that may need this (like weather station, aquarium monitoring...)
- host a user database, to authenticate master module registration, statistic and log recording.
The web server needs to run php and a mySql database, preferably on Apache, or you'll have to adapt the provided configuration files.
The necessary files for this website are in the "webSite" folder (great name), including the sql files to create the tables in your database server.
If anyone is interested in working on this project but does not feel like setting up a website with a DB, feel free to use http://www.iotinator.com. I try to not break the UI files on it as much as possible :)
Get it touch to get your API KEY (user registration is manual for now, it's yet another project), and/or if you need some UI files to be uploaded on it.
The esp boards are not that powerful, and it would be a waste of resources to have them serve all the files needed by the web UI. Also, it would require to flash new versions for each modification, which is a bit heavy and would make development tedious.
Instead, only a short bootstrap HTML page is hosted on the master, that loads many css and js files from either CDN (for libs such as jQuery, or frameworks), and from the website provided on the initialization page for the web app UI files. Of course you'll need to set up your web server to provide the necessary headers to allow such loading from the local page provided by the master: Header set Access-Control-Allow-Origin "*"
If everything is properly installed on the host and the DB properly provisionned, the master will register itself to it. This registration allows for auto discoverability by opening your browser on http://iotinator.com/my: when you are connected to the same wifi network, you'll be redirected to the UI to control the agents. This way you need not know the IP address of the master on your home wifi network, and safely use DHCP on your router.
Depending on your hosting plan, you can setup sub-domains, and I've created http://my.iotinator.com to redirect to '/my', so it's even more compact.
For now, it holds a table for users, and one for master module autodiscovery. The user table holds an API KEY per user, that needs to be provided to somehow authenticate requests that need to be. Scripts to create these tables are provided in the webSite/sql directory for the repo.