Files
ciomek 8fbc7fed7d
Build and Push Docker Image / build-and-push (push) Successful in 15s
JSON parse
2026-08-16 13:23:26 +02:00

18 lines
431 B
Python

import json
from loon.web.users.state import user_threads
async def player_handler(client, userdata, msg, data):
prefix = "loon/player/"
if not msg.topic.startswith(prefix):
return
rest = msg.topic[len(prefix):]
player_uuid, _, subtopic = rest.partition("/")
queue = user_threads.get(player_uuid)
if queue is not None:
await queue.put(json.dumps({"topic": subtopic, "payload": data}))