debug: add data_received event logging to diagnose data channel

This commit is contained in:
hailin 2026-03-02 06:38:02 -08:00
parent 63b986fced
commit 81e36bf859
1 changed files with 10 additions and 0 deletions

View File

@ -343,8 +343,18 @@ async def entrypoint(ctx: JobContext) -> None:
type(exc).__name__, exc, exc_info=True,
)
# Debug: log ALL data_received events to verify the event fires
def _debug_data_received(dp):
logger.info(
"DEBUG data_received: type=%s topic=%s data_len=%d",
type(dp).__name__,
getattr(dp, 'topic', 'NO_TOPIC_ATTR'),
len(getattr(dp, 'data', b'')),
)
# Use ensure_future because ctx.room.on() uses a sync event emitter
# (same pattern as the "disconnected" handler above)
ctx.room.on("data_received", _debug_data_received)
ctx.room.on("data_received", lambda dp: asyncio.ensure_future(_on_data_received(dp)))
except Exception as exc: