ESPHome
2026.12.0-dev
Loading...
Searching...
No Matches
esphome
components
web_server_base
stream_response.h
Go to the documentation of this file.
1
#pragma once
2
3
#include "
esphome/core/defines.h
"
4
5
// The long lived stream response the /events layer writes to, for the platform's web server
6
#ifdef USE_ESP32
7
#include "
esphome/components/web_server_idf/web_server_idf.h
"
8
#include "
esphome/core/helpers.h
"
9
10
#include <sys/socket.h>
11
12
namespace
esphome::web_server_base
{
13
using
web_server_idf::AsyncStreamResponse;
14
// One entry of the gather list AsyncStreamResponse::write() takes
15
using
StreamIovec
=
::iovec
;
16
// Guards the hand-off of new streams from the server task to the main loop
17
using
StreamIntakeGuard
=
LockGuard
;
18
}
// namespace esphome::web_server_base
19
#elif defined(USE_ARDUINO)
20
// ESP8266, RP2040 and LibreTiny: ESPAsyncWebServer, with the connection taken from the request
21
#include "
async_stream_response.h
"
22
#include "
esphome/core/helpers.h
"
23
24
namespace
esphome::web_server_base
{
25
// Guards the hand-off of new streams from the network context to the main loop: the lwIP lock keeps RP2's network
26
// IRQ out, the mutex LibreTiny's async_tcp task; each is a no-op where it is not needed (both on ESP8266)
27
class
StreamIntakeGuard
{
28
public
:
29
explicit
StreamIntakeGuard
(
Mutex
&mutex) :
guard_
(mutex) {}
30
31
protected
:
32
LwIPLock
lock_
;
33
LockGuard
guard_
;
34
};
35
}
// namespace esphome::web_server_base
36
#endif
async_stream_response.h
esphome::LockGuard
Helper class that wraps a mutex with a RAII-style API.
Definition
helpers.h:2494
esphome::LwIPLock
Helper class to lock the lwIP TCPIP core when making lwIP API calls from non-TCPIP threads.
Definition
helpers.h:2548
esphome::Mutex
Mutex implementation, with API based on the unavailable std::mutex.
Definition
helpers.h:2455
esphome::web_server_base::StreamIntakeGuard
Definition
stream_response.h:27
esphome::web_server_base::StreamIntakeGuard::lock_
LwIPLock lock_
Definition
stream_response.h:32
esphome::web_server_base::StreamIntakeGuard::guard_
LockGuard guard_
Definition
stream_response.h:33
esphome::web_server_base::StreamIntakeGuard::StreamIntakeGuard
StreamIntakeGuard(Mutex &mutex)
Definition
stream_response.h:29
defines.h
helpers.h
esphome::web_server_base
Definition
async_stream_response.cpp:16
esphome::web_server_base::StreamIovec
One entry of the gather list AsyncStreamResponse::write() takes; the TCP libraries take plain buffers...
Definition
async_stream_response.h:22
iovec
Definition
headers.h:112
web_server_idf.h
Generated by
1.12.0