Merge remote-tracking branch 'upstream/web_server_idf_session_ownership' into integration

This commit is contained in:
J. Nick Koston
2026-04-24 03:11:28 -05:00
2 changed files with 5 additions and 1 deletions
@@ -532,10 +532,12 @@ void AsyncEventSource::adopt_pending_sessions_main_loop_() {
continue;
}
this->sessions_.push_back(rsp);
// Prime first so on_connect_ observes a session that has already sent its
// initial ping/config/sorting_groups, matching the pre-refactor ordering.
rsp->start_session_main_loop_();
if (this->on_connect_) {
this->on_connect_(rsp);
}
rsp->start_session_main_loop_();
}
}
@@ -339,6 +339,8 @@ class AsyncEventSource : public AsyncWebHandler {
// NOLINTNEXTLINE(readability-identifier-naming)
void handleRequest(AsyncWebServerRequest *request) override;
// NOLINTNEXTLINE(readability-identifier-naming)
// Callback runs on the main loop (not the httpd task) after the session's
// initial ping/config/sorting_groups have been sent.
void onConnect(connect_handler_t &&cb) { this->on_connect_ = std::move(cb); }
void try_send_nodefer(const char *message, const char *event = nullptr, uint32_t id = 0, uint32_t reconnect = 0);