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
{{ message }}
This repository was archived by the owner on Jan 21, 2025. It is now read-only.
The fork from yubox introduces some breaking API changes compared to the original library, especially regarding the use of `std::shared_ptr<std::vector<uint8_t>>` for WebSocket.
29
+
Thanks to this fork, you can handle them by using `ASYNCWEBSERVER_FORK_mathieucarbou`.
30
+
31
+
Here is an example for serializing a Json document in a websocket message buffer directly.
32
+
This code is compatible with both forks.
33
+
34
+
```cpp
35
+
voidsend(JsonDocument& doc) {
36
+
const size_t len = measureJson(doc);
37
+
38
+
#if defined(ASYNCWEBSERVER_FORK_mathieucarbou)
39
+
40
+
// this fork (originally from yubox-node-org), uses another API with shared pointer that better support concurrent use cases then the original project
41
+
auto buffer = std::make_shared<std::vector<uint8_t>>(len);
42
+
assert(buffer); // up to you to keep or remove this
The fork from yubox introduces some breaking API changes compared to the original library, especially regarding the use of `std::shared_ptr<std::vector<uint8_t>>` for WebSocket.
29
+
Thanks to this fork, you can handle them by using `ASYNCWEBSERVER_FORK_mathieucarbou`.
30
+
31
+
Here is an example for serializing a Json document in a websocket message buffer directly.
32
+
This code is compatible with both forks.
33
+
34
+
```cpp
35
+
voidsend(JsonDocument& doc) {
36
+
const size_t len = measureJson(doc);
37
+
38
+
#if defined(ASYNCWEBSERVER_FORK_mathieucarbou)
39
+
40
+
// this fork (originally from yubox-node-org), uses another API with shared pointer that better support concurrent use cases then the original project
41
+
auto buffer = std::make_shared<std::vector<uint8_t>>(len);
42
+
assert(buffer); // up to you to keep or remove this
0 commit comments