Original by chriscook8 from esp8266.com I just modified to use ESP8266WebServer library for easy to handle the http request.
This is sample code not yet complete.
- when Wifi connected need to close the softAP.
| /* | |
| * ESP8266 Web server with Web Socket to control an LED. | |
| * | |
| * The web server keeps all clients' LED status up to date and any client may | |
| * turn the LED on or off. | |
| * | |
| * For example, clientA connects and turns the LED on. This changes the word | |
| * "LED" on the web page to the color red. When clientB connects, the word | |
| * "LED" will be red since the server knows the LED is on. When clientB turns | |
| * the LED off, the word LED changes color to black on clientA and clientB web |
| // Dead simple compressed and encrypted datastore | |
| var crypto = require('crypto'); | |
| var zlib = require('zlib'); | |
| var fs = require('fs'); | |
| var stream = require('stream'); | |
| // Load the session store from #{filename} and decrypt it using #{method} with | |
| // the key #{key}. | |
| // @param filename {String} filename | |
| // @param key the encryption key, can be a string or buffer |