This commit is contained in:
xyj 2024-01-24 16:01:52 +08:00
parent 55d146bcdc
commit 109e972fa6
1 changed files with 10 additions and 3 deletions

13
main.py
View File

@ -116,9 +116,16 @@ async def process_data(request: Request):
data = await request.body() data = await request.body()
data = data.decode("utf-8") data = data.decode("utf-8")
data = json.loads(data) data = json.loads(data)
print(data) event = data["event"]
if event == "client.connected":
print("已连接")
print(data["connected_at"])
elif event == "client.disconnected":
print("已断开")
print(data["disconnected_at"])
elif event == "message.publish":
print("消息接收")
print(data["timestamp"])
return 200 return 200
# try: # try:
# data = await request.body() # data = await request.body()