added try for return

This commit is contained in:
ben 2022-11-23 22:31:11 +00:00
parent 2f08255e92
commit 152991fbec

View File

@ -731,11 +731,19 @@ async def websocket_connect(websocket: WebSocket, item_id: str):
@core_app.post("/api/v1/ws/{item_id}")
async def websocket_update(item_id: str, data: str):
await updater(item_id, data)
try:
await updater(item_id, data)
return {"sent": True, "data": data}
except:
return {"sent": False, "data": data}
@core_app.get("/api/v1/ws/{item_id}/{data}")
async def websocket_update(item_id: str, data: str):
await updater(item_id, data)
try:
await updater(item_id, data)
return {"sent": True, "data": data}
except:
return {"sent": False, "data": data}
async def updater(item_id, data):
return await manager.send_data(