mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 12:59:34 +00:00
Better handle large amounts of data being sent over WS (#23842)
* Better handle large amounts of data being sent over WS * Lint
This commit is contained in:
@@ -36,6 +36,13 @@ class ActiveConnection:
|
||||
"""Send a result message."""
|
||||
self.send_message(messages.result_message(msg_id, result))
|
||||
|
||||
async def send_big_result(self, msg_id, result):
|
||||
"""Send a result message that would be expensive to JSON serialize."""
|
||||
content = await self.hass.async_add_executor_job(
|
||||
const.JSON_DUMP, messages.result_message(msg_id, result)
|
||||
)
|
||||
self.send_message(content)
|
||||
|
||||
@callback
|
||||
def send_error(self, msg_id, code, message):
|
||||
"""Send a error message."""
|
||||
|
||||
Reference in New Issue
Block a user