Echo service.

This commit is contained in:
retoor 2025-02-11 21:11:21 +01:00
parent 2541fc536a
commit b6eba60843

View File

@ -128,6 +128,7 @@ class RPCView(BaseView):
except Exception as ex: except Exception as ex:
result = {"exception": str(ex), "traceback": traceback.format_exc()} result = {"exception": str(ex), "traceback": traceback.format_exc()}
success = False success = False
if result != "noresponse":
await self._send_json({"callId": call_id, "success": success, "data": result}) await self._send_json({"callId": call_id, "success": success, "data": result})
except Exception as ex: except Exception as ex:
await self._send_json({"callId": call_id, "success": False, "data": str(ex)}) await self._send_json({"callId": call_id, "success": False, "data": str(ex)})
@ -141,6 +142,9 @@ class RPCView(BaseView):
return [dict(uid=record['uid'],username=record['username'], nick=record['nick'],last_ping=record['last_ping']) async for record in self.services.channel.get_online_users(channel_uid)] return [dict(uid=record['uid'],username=record['username'], nick=record['nick'],last_ping=record['last_ping']) async for record in self.services.channel.get_online_users(channel_uid)]
async def echo(self, obj):
await self.ws.send_json(obj)
return "noresponse"
async def get_users(self, channel_uid): async def get_users(self, channel_uid):
self._require_login() self._require_login()