websockets: Add "update_response" notification

This will send output from "update" commands over the websocket to clients.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Arksine 2020-11-21 08:38:56 -05:00
parent d9af161a18
commit 21a7a4e530
1 changed files with 5 additions and 0 deletions

View File

@ -182,6 +182,8 @@ class WebsocketManager:
"file_manager:metadata_update", self._handle_metadata_update)
self.server.register_event_handler(
"gpio_power:power_changed", self._handle_power_changed)
self.server.register_event_handler(
"update_manager:update_response", self._handle_update_response)
async def _handle_klippy_ready(self):
await self.notify_websockets("klippy_ready")
@ -201,6 +203,9 @@ class WebsocketManager:
async def _handle_power_changed(self, pstatus):
await self.notify_websockets("power_changed", pstatus)
async def _handle_update_response(self, response):
await self.notify_websockets("update_response", response)
def register_local_handler(self, api_def, callback):
for ws_method, req_method in \
zip(api_def.ws_methods, api_def.request_methods):