mirror of
https://github.com/esphome/esphome.git
synced 2026-09-16 01:28:39 +00:00
Merge remote-tracking branch 'upstream/web_server_idf_session_ownership' into integration
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user