mirror of
https://github.com/rstrouse/ESPSomfy-RTS.git
synced 2026-10-31 22:02:17 +01:00
Memory-bounded streaming builder for /controller. Produces the JSON payload one small unit at a time into a fixed 3KB buffer, so a chunked HTTP response can drain it as the TCP send window allows — no growing cbuf in the async response stream.
This commit is contained in:
parent
f51e90bb7c
commit
6365f16850
4 changed files with 270 additions and 31 deletions
|
|
@ -52,6 +52,11 @@ class JsonFormatter {
|
|||
void addElem(const char *name, const char *val);
|
||||
void addElem(const char* name, uint64_t lval);
|
||||
};
|
||||
class BufferedJsonFormatter : public JsonFormatter {
|
||||
public:
|
||||
void setBuffer(char *b, size_t sz);
|
||||
size_t length() const;
|
||||
};
|
||||
class AsyncJsonResp : public JsonFormatter {
|
||||
protected:
|
||||
void _safecat(const char *val, bool escape = false) override;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue