You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+22-2Lines changed: 22 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,23 +2,43 @@
2
2
3
3
All notable changes to this project will be documented in this file.
4
4
5
-
## [WIP] - Current Main
5
+
## [0.5.0] - 2024-05-06
6
+
7
+
Changes the Event Socket System to use a clearer message structure and MessagePack. Brings breaking changes to the `EventSocket.h` API.
8
+
9
+
Updated daisyUI to v4. This has changes in the colors and switches to OKLCH. Also button groups and input groups have been depreciated in favor of join. This might require changes to custom parts of the code. Please double check all websites if the still have the desired looks.
10
+
11
+
Updates ArduinoJSON from v6 to v7 to increase the available free heap. If you make use of ArduinoJSON, changes might be required.
6
12
7
13
### Added
8
14
15
+
- Debug buildflag to switch between MessagePack and JSON for event messages.
16
+
- Show SSID of the current WiFi Station as tooltip of the RSSI icon.
17
+
9
18
### Changed
10
19
11
20
- Moved MQTT types to models.ts as well. [#49](https://github.com/theelims/ESP32-sveltekit/pull/49)
12
-
- Fixed spelling error in models.tsnpm audit
21
+
- Updated daisyUI to 4.10.2 [#48](https://github.com/theelims/ESP32-sveltekit/pull/48)
22
+
- Fixed spelling error in models.ts
23
+
- Changed ArduinoJson from v6 to v7 increasing the free heap by ~40kb
24
+
- Split NotificationService out of EventSocket into own class
25
+
- Changed API of EventSocket.h. Now uses `void emitEvent(String event, JsonObject &jsonObject, const char *originId = "", bool onlyToSameOrigin = false);`.
26
+
- Changed event socket message format to MessagePack
13
27
14
28
### Fixed
15
29
16
30
- Fixes to WiFi.svelte and models.ts to fix type errors and visibility rights.
31
+
- Fixes bug in highlighting the menu when navigating with the browser (back/forward)
32
+
- Made WiFi connection routine more robust by using BSSID. Ensures that the STA truly connects to the strongest hotspot, even if several hotspots are in reach.
17
33
18
34
### Removed
19
35
20
36
- Removed duplicate in ESP32SvelteKit.cpp [#47](https://github.com/theelims/ESP32-sveltekit/pull/47) and WiFi.svelte [#50](https://github.com/theelims/ESP32-sveltekit/pull/50)
21
37
38
+
### Acknowledgment
39
+
40
+
Many thanks to @runeharlyk who contributed significantly to the new event socket system and fixed many smaller issues with the front-end.
41
+
22
42
## [0.4.0] - 2024-04-21
23
43
24
44
This upgrade might require one minor change as `MqttPubSub.h` and its class had been renamed to `MqttEndpoint.h` and `MqttEndoint` respectively. However, it is strongly advised, that you change all existing WebSocketServer endpoints to the new event socket system.
Copy file name to clipboardExpand all lines: docs/buildprocess.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -56,12 +56,12 @@ In addition custom features might be added or removed at runtime. See [Custom Fe
56
56
57
57
## Factory Settings
58
58
59
-
The framework has built-in factory settings which act as default values for the various configurable services where settings are not saved on the file system. These settings can be overridden using the build flags defined in [factory_settings.ini](https://github.com/theelims/ESP32-sveltekit/blob/main/factory_settings.ini).
59
+
The framework has built-in factory settings which act as default values for the various configurable services where settings are not saved on the file system. These settings can be overridden using the build flags defined in [factory_settings.ini](https://github.com/theelims/ESP32-sveltekit/blob/main/factory_settings.ini). All strings entered here must be escaped, especially special characters.
60
60
61
61
Customize the settings as you see fit, for example you might configure your home WiFi network as the factory default:
Copy file name to clipboardExpand all lines: docs/statefulservice.md
+29-7Lines changed: 29 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -303,14 +303,36 @@ The demo project allows the user to modify the MQTT topics via the UI so they ca
303
303
304
304
Beside RESTful HTTP Endpoints the Event Socket System provides a convenient communication path between the client and the ESP32. It uses a single WebSocket connection to synchronize state and to push realtime data to the client. The client needs to subscribe to the topics he is interested. Only clients who have an active subscription will receive data. Every authenticated client may make use of this system as the security settings are set to `AuthenticationPredicates::IS_AUTHENTICATED`.
305
305
306
+
### Message Format
307
+
308
+
The event messages exchanged between the ESP32 and its clients consists of an "event" head and the "data" payload. For the LightState example a message looks like this in JSON representation:
309
+
310
+
```JSON
311
+
{
312
+
"event": "led",
313
+
"data": {
314
+
"led_on": true
315
+
}
316
+
}
317
+
```
318
+
319
+
To save on bandwidth the event message is encoded as binary [MessagePack](https://msgpack.org/) instead of a JSON.
320
+
321
+
To subscribe the client has to send the following message (as MessagePack):
322
+
323
+
```JSON
324
+
{
325
+
"event": "subscribe",
326
+
"data": "analytics"
327
+
}
328
+
```
329
+
306
330
### Emit an Event
307
331
308
-
The Event Socket provides an overloaded `emit()` function to push data to all subscribed clients. This is used by various esp32sveltekit classes to push real time data to the client. First an event must be registered with the Event Socket by calling `_socket.registerEvent("CustomEvent");`. Only then clients may subscribe to this custom event and you're entitled to emit event data:
332
+
The Event Socket provides an `emitEvent()` function to push data to all subscribed clients. This is used by various esp32sveltekit classes to push real time data to the client. First an event must be registered with the Event Socket by calling `_socket.registerEvent("CustomEvent");`. Only then clients may subscribe to this custom event and you're entitled to emit event data:
The latter function allowing a selection of the recipient. If `onlyToSameOrigin = false` the payload is distributed to all subscribed clients, except the `originId`. If `onlyToSameOrigin = true` only the client with `originId` will receive the payload. This is used by the [EventEndpoint](#event-socket-endpoint) to sync the initial state when a new client subscribes.
@@ -331,7 +353,7 @@ _socket.onEvent("CostumEvent",[&](JsonObject &root, int originId)
331
353
Similarly a callback or lambda function may be registered to get notified when a client subscribes to an event:
@@ -344,7 +366,7 @@ The boolean parameter provided will always be `true`.
344
366
It is possibly to send push notifications to all clients by using the Event Socket. These will be displayed as toasts an the client side. Either directly call
345
367
346
368
```cpp
347
-
esp32sveltekit.getSocket()->pushNotification("Pushed a message!", PUSHINFO);
369
+
esp32sveltekit.getNotificationService()->pushNotification("Pushed a message!", PUSHINFO);
348
370
```
349
371
350
372
or keep a local pointer to the `EventSocket` instance. It is possible to send `PUSHINFO`, `PUSHWARNING`, `PUSHERROR` and `PUSHSUCCESS` events to all clients.
@@ -377,7 +399,7 @@ In case of a websocket connection the JWT token is supplied as a search paramete
377
399
378
400
## Placeholder substitution
379
401
380
-
Various settings support placeholder substitution, indicated by comments in [factory_settings.ini](https://github.com/theelims/ESP32-sveltekit/blob/main/factory_settings.ini). This can be particularly useful where settings need to be unique, such as the Access Point SSID or MQTT client id. The following placeholders are supported:
402
+
Various settings support placeholder substitution, indicated by comments in [factory_settings.ini](https://github.com/theelims/ESP32-sveltekit/blob/main/factory_settings.ini). This can be particularly useful where settings need to be unique, such as the Access Point SSID or MQTT client id. Strings must be properly escaped in the ini-file. The following placeholders are supported:
-`icon` must be an icon component giving the menu items icon.
69
68
-`href` is the link to the route the menu item refers to.
70
69
-`feature` takes a bool and should be set to `true`. It is used by the [feature selector](#features) to hide a menu entry of it is not present on the back end.
71
-
-`active` takes a bool as well and should be set to `false` by default. It is automatically set to `true` to highlight a menu entry as active.
0 commit comments