Rework backend add MQTT and WebSocket support
* Update back end to add MQTT and WebSocket support * Update demo project to demonstrate MQTT and WebSockets * Update documentation to describe newly added and modified functionallity * Introduce separate MQTT pub/sub, HTTP get/post and WebSocket rx/tx classes * Significant reanaming - more accurate class names * Use PROGMEM_WWW as default * Update README documenting PROGMEM_WWW as default * Update README with API changes
This commit is contained in:
20
src/main.cpp
20
src/main.cpp
@@ -1,12 +1,18 @@
|
||||
#include <DemoProject.h>
|
||||
#include <ESP8266React.h>
|
||||
#include <LightMqttSettingsService.h>
|
||||
#include <LightStateService.h>
|
||||
#include <FS.h>
|
||||
|
||||
#define SERIAL_BAUD_RATE 115200
|
||||
|
||||
AsyncWebServer server(80);
|
||||
ESP8266React esp8266React(&server, &SPIFFS);
|
||||
DemoProject demoProject = DemoProject(&server, &SPIFFS, esp8266React.getSecurityManager());
|
||||
LightMqttSettingsService lightMqttSettingsService =
|
||||
LightMqttSettingsService(&server, &SPIFFS, esp8266React.getSecurityManager());
|
||||
LightStateService lightStateService = LightStateService(&server,
|
||||
esp8266React.getSecurityManager(),
|
||||
esp8266React.getMqttClient(),
|
||||
&lightMqttSettingsService);
|
||||
|
||||
void setup() {
|
||||
// start serial and filesystem
|
||||
@@ -22,8 +28,11 @@ void setup() {
|
||||
// start the framework and demo project
|
||||
esp8266React.begin();
|
||||
|
||||
// start the demo project
|
||||
demoProject.begin();
|
||||
// load the initial light settings
|
||||
lightStateService.begin();
|
||||
|
||||
// start the light service
|
||||
lightMqttSettingsService.begin();
|
||||
|
||||
// start the server
|
||||
server.begin();
|
||||
@@ -32,7 +41,4 @@ void setup() {
|
||||
void loop() {
|
||||
// run the framework's loop function
|
||||
esp8266React.loop();
|
||||
|
||||
// run the demo project's loop function
|
||||
demoProject.loop();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user