Increase core websocket proxy maximum message size to 64MiB (#4443)
This commit is contained in:
parent
f1a72ee418
commit
f9bc2f5993
|
@ -18,6 +18,13 @@ _LOGGER: logging.Logger = logging.getLogger(__name__)
|
||||||
FORWARD_HEADERS = ("X-Speech-Content",)
|
FORWARD_HEADERS = ("X-Speech-Content",)
|
||||||
HEADER_HA_ACCESS = "X-Ha-Access"
|
HEADER_HA_ACCESS = "X-Ha-Access"
|
||||||
|
|
||||||
|
# Maximum message size for websocket messages from Home Assistant.
|
||||||
|
# Since these are coming from core we want the largest possible size
|
||||||
|
# that is not likely to cause a memory problem as most modern browsers
|
||||||
|
# support large messages.
|
||||||
|
# https://github.com/home-assistant/supervisor/issues/4392
|
||||||
|
MAX_MESSAGE_SIZE_FROM_CORE = 64 * 1024 * 1024
|
||||||
|
|
||||||
|
|
||||||
class APIProxy(CoreSysAttributes):
|
class APIProxy(CoreSysAttributes):
|
||||||
"""API Proxy for Home Assistant."""
|
"""API Proxy for Home Assistant."""
|
||||||
|
@ -112,7 +119,9 @@ class APIProxy(CoreSysAttributes):
|
||||||
url = f"{self.sys_homeassistant.api_url}/api/websocket"
|
url = f"{self.sys_homeassistant.api_url}/api/websocket"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
client = await self.sys_websession.ws_connect(url, heartbeat=30, ssl=False)
|
client = await self.sys_websession.ws_connect(
|
||||||
|
url, heartbeat=30, ssl=False, max_msg_size=MAX_MESSAGE_SIZE_FROM_CORE
|
||||||
|
)
|
||||||
|
|
||||||
# Handle authentication
|
# Handle authentication
|
||||||
data = await client.receive_json()
|
data = await client.receive_json()
|
||||||
|
|
Loading…
Reference in New Issue