Skip to content

Commit

Permalink
More docs
Browse files Browse the repository at this point in the history
  • Loading branch information
theelims committed Jan 14, 2024
1 parent 848c628 commit 0f820dd
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
18 changes: 15 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ All notable changes to this project will be documented in this file.
- Removed support for Arduino ESP OTA.
- HttpEndpoints and Websocket Server without a securityManager are no longer possible.

### Migrate from ESPAsnyWebServer
### Migrate from ESPAsyncWebServer

#### Migrate `main.cpp`

Expand All @@ -38,13 +38,25 @@ Remove `server.begin();` in `void setup()`. This is handled by ESP32SvelteKit no

#### Migrate `platformio.ini`

Remove `-D CONFIG_ASYNC_TCP_RUNNING_CORE=0`, `-D NO_GLOBAL_ARDUINOOTA` and `esphome/AsyncTCP-esphome @ ^2.0.0`. Add `https://github.com/hoeken/PsychicHttp.git` as lib dependency.
Remove the following `build_flags`:

```ini
; Increase queue size of SSE and WS
-D SSE_MAX_QUEUED_MESSAGES=64
-D WS_MAX_QUEUED_MESSAGES=64
-D CONFIG_ASYNC_TCP_RUNNING_CORE=0
-D NO_GLOBAL_ARDUINOOTA
```

Change `-D CORE_DEBUG_LEVEL=2` to no higher than 2.

Remove the lib dependency `esphome/AsyncTCP-esphome @ ^2.0.0` and add `https://github.com/hoeken/PsychicHttp.git` instead.

#### Custom Stateful Services

Adapt the class constructor (`(PsychicHttpServer *server, ...`) to PsychicHttpServer.

Due to the loading sequence HttpEndoint and WebsocketServer both have become a `begin()` function to register their http endpoints with the server. This must be called in your stateful services own `begin()` function:
Due to the loading sequence HttpEndoint and WebsocketServer both have become a `begin()` function to register their http endpoints with the server. This must be called in your stateful services' own `begin()` function:

```
void LightStateService::begin()
Expand Down
4 changes: 2 additions & 2 deletions docs/statefulservice.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ The code below demonstrates how to extend the LightStateService class to provide
class LightStateService : public StatefulService<LightState> {
public:
LightStateService(PsychicHttpServer* server, SecurityManager *securityManager) :
_httpEndpoint(LightState::read, LightState::update, this, server, "/rest/lightState", securityManager, AuthenticationPredicates::IS_AUTHENTICATED) {
_httpEndpoint(LightState::read, LightState::update, this, server, "/rest/lightState", securityManager,AuthenticationPredicates::IS_AUTHENTICATED) {
}
private:
Expand Down Expand Up @@ -200,7 +200,7 @@ The code below demonstrates how to extend the LightStateService class to provide
class LightStateService : public StatefulService<LightState> {
public:
LightStateService(PsychicHttpServer* server, SecurityManager *securityManager) :
_webSocket(LightState::read, LightState::update, this, server, "/ws/lightState", securityManager, AuthenticationPredicates::IS_AUTHENTICATED), {
_webSocket(LightState::read, LightState::update, this, server, "/ws/lightState", securityManager, AuthenticationPredicates::IS_AUTHENTICATED), {
}
private:
Expand Down
3 changes: 0 additions & 3 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ build_flags =
-D BUILD_TARGET="$PIOENV"
-D APP_NAME=\"ESP32-Sveltekit\" ; Must only contain characters from [a-zA-Z0-9-_] as this is converted into a filename
-D APP_VERSION=\"0.2.2\" ; semver compatible version string
; Increase queue size of SSE and WS
-D SSE_MAX_QUEUED_MESSAGES=64
-D WS_MAX_QUEUED_MESSAGES=64
; Uncomment to receive log messages from the ESP Arduino Core
-D CORE_DEBUG_LEVEL=5
; Move all networking stuff to the protocol core 0 and leave business logic on application core 1
Expand Down

0 comments on commit 0f820dd

Please sign in to comment.