File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -114,6 +114,29 @@ class WebSerialClass : public Print {
114114 // The buffer is not enabled by default.
115115 void setBuffer (size_t initialCapacity);
116116
117+ #ifdef WSL_HIGH_PERF
118+ #ifdef ASYNCWEBSERVER_FORK_mathieucarbou
119+ // Expose the internal WebSocket makeBuffer to even improve memory consumption on client-side
120+ // 1. make a AsyncWebSocketMessageBuffer
121+ // 2. put the data inside
122+ // 3. send the buffer
123+ // This method avoids a buffer copy when creating the WebSocket message
124+ AsyncWebSocketMessageBuffer* makeBuffer (size_t size = 0 ) {
125+ if (!_ws)
126+ return nullptr ;
127+ return _ws->makeBuffer (size);
128+ }
129+
130+ void send (AsyncWebSocketMessageBuffer* buffer) {
131+ if (!_ws || !buffer)
132+ return ;
133+ _ws->cleanupClients (WSL_MAX_WS_CLIENTS);
134+ if (_ws->count ())
135+ _ws->textAll (buffer);
136+ }
137+ #endif
138+ #endif
139+
117140 private:
118141 // Server
119142 AsyncWebServer *_server;
You can’t perform that action at this time.
0 commit comments