mirror of
https://github.com/home-assistant/supervisor.git
synced 2026-04-02 00:07:16 +01:00
fix: remove WebSocket message size limit in ingress proxy (#6604)
aiohttp's default max_msg_size of 4MB causes the ingress WebSocket proxy to silently drop connections when an add-on sends messages larger than that limit (e.g. Zigbee2MQTT's bridge/devices payload with many devices). Setting max_msg_size=0 removes the limit on both the server-side WebSocketResponse and the upstream ws_connect, fixing dropped connections for add-ons that produce large WebSocket messages. Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
@@ -39,6 +39,8 @@ from .utils import api_process, api_validate, require_home_assistant
|
||||
|
||||
_LOGGER: logging.Logger = logging.getLogger(__name__)
|
||||
|
||||
MAX_WEBSOCKET_MESSAGE_SIZE = 16 * 1024 * 1024 # 16 MiB
|
||||
|
||||
VALIDATE_SESSION_DATA = vol.Schema({ATTR_SESSION: str})
|
||||
|
||||
"""Expected optional payload of create session request"""
|
||||
@@ -180,7 +182,10 @@ class APIIngress(CoreSysAttributes):
|
||||
req_protocols = []
|
||||
|
||||
ws_server = web.WebSocketResponse(
|
||||
protocols=req_protocols, autoclose=False, autoping=False
|
||||
protocols=req_protocols,
|
||||
autoclose=False,
|
||||
autoping=False,
|
||||
max_msg_size=MAX_WEBSOCKET_MESSAGE_SIZE,
|
||||
)
|
||||
await ws_server.prepare(request)
|
||||
|
||||
@@ -201,6 +206,7 @@ class APIIngress(CoreSysAttributes):
|
||||
protocols=req_protocols,
|
||||
autoclose=False,
|
||||
autoping=False,
|
||||
max_msg_size=MAX_WEBSOCKET_MESSAGE_SIZE,
|
||||
) as ws_client:
|
||||
# Proxy requests
|
||||
await asyncio.wait(
|
||||
|
||||
Reference in New Issue
Block a user