mirror of
https://github.com/me-no-dev/ESPAsyncWebServer.git
synced 2026-01-27 09:12:18 +01:00
Replace entire AsyncWebSocketBuffer infrastructure with std::shared_ptr
Based on commit 9172736ac28e7c2f3edd0c56434bc27f578a89b1 of dumbfixes branch of 0xFEEDC0DE64 fork of ESPAsyncWebServer. The entire purpose of having an AsyncWebSocketMessageBuffer is to maintain a shared copy of a buffer sent to multiple clients until all of them finish sending it. This can be replaced with a single message object that contains a shared_ptr to the data being sent. For the single client case, this is equivalent to non-shared buffer. For multiple clients, the shared_ptr will maintain the buffer live until all messages referencing it are destroyed. This simplifies the websocket architecture.
This commit is contained in: