Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: see if availableForWriteAll() is a problem #1579

Draft
wants to merge 2 commits into
base: development
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/MessageOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ void MessageOutputClass::loop()
return;
}

while (!_lines.empty() && _ws->availableForWriteAll()) {
while (!_lines.empty()) {
Syslog.write(_lines.front().data(), _lines.front().size());
_ws->textAll(std::make_shared<message_t>(std::move(_lines.front())));
_lines.pop();
Expand Down
7 changes: 5 additions & 2 deletions src/WebApi_ws_console.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ void WebApiWsConsoleClass::reload()

void WebApiWsConsoleClass::wsCleanupTaskCb()
{
// see: https://github.com/me-no-dev/ESPAsyncWebServer#limiting-the-number-of-web-socket-clients
_ws.cleanupClients();
// see: https://github.com/ESP32Async/ESPAsyncWebServer#limiting-the-number-of-web-socket-clients
// calling this function without an argument will use a default maximum
// number of clients to keep. since the web console is using quite a lot
// of memory, we only permit two clients at the same time.
_ws.cleanupClients(2);
}