able-egg-38713
12/31/2025, 10:15 AMtall-airline-16756
12/31/2025, 10:15 AMtall-airline-16756
12/31/2025, 10:15 AMon_participant_connected handler isn’t firing.
A few common causes — please check and tell me which apply:
• Did you register the on_participant_connected listener before connecting to the room (or before the other participant joined)? If the listener is added after the participant already joined, the event won’t fire for that join.
• Is the room in Livestream Mode? In Livestream Mode, subscriber-only (viewer) participants do not trigger `on_participant_connected`; only publisher participants (those that publish a track or set metadata/attributes) do.
• Is the participant actually publishing any tracks or setting metadata (i.e., a publisher)? If not, they may be treated as viewer/subscriber.
• Are you seeing any errors in the client logs around connect or event registration? Any relevant log lines or SDK + version info will help.
Please tell me:
1. Which SDK and version you’re using.
2. Whether you’re in Livestream Mode.
3. A short snippet showing where you add the listener and where you call connect() (or confirm the order).
With that I can give exact, concrete steps to fix it.
Sources: Job lifecycle | LiveKit docs | client-sdk-flutter | livekit/livekit_composite | DeepWiki | Livestream Modeable-egg-38713
12/31/2025, 10:20 AMtall-airline-16756
12/31/2025, 10:20 AMon_participant_connected listener before calling connect() (or before the other participant joined)?
2. Is the room running in Livestream Mode?
If both are true, please paste the small code snippet that shows where you add the listener and where you call connect() (3–6 lines is enough). With that I’ll tell you the exact fix.able-egg-38713
12/31/2025, 10:21 AMtall-airline-16756
12/31/2025, 10:21 AM@ctx.room.on("participant_connected") before calling ctx.connect() (or before other participants may join). Event listeners only capture events that occur after they are registered.
If you’re in Livestream Mode, note that subscriber-only viewers won’t trigger participant_connected — only publisher participants (those that publish a track or set metadata) will.
Please paste 3–6 lines showing where you add the listener and where you call ctx.connect() if you want me to check the exact ordering.able-egg-38713
12/31/2025, 10:30 AMclass RealtimeEntrypoint():
async def voice_agent(self, ctx: JobContext):
await ctx.connect(auto_subscribe=AutoSubscribe.SUBSCRIBE_ALL)
@ctx.room.on("participant_connected")
def on_participant_connected(participant):tall-airline-16756
12/31/2025, 10:30 AMctx.connect(). In your snippet the listener is added after await ctx.connect(...), so it will miss participant join events that happen during or before connect.
Please move the listener registration above the connect call, for example:
@ctx.room.on("participant_connected")
def on_participant_connected(participant):
...
await ctx.connect(auto_subscribe=AutoSubscribe.SUBSCRIBE_ALL)
If you need to detect participants who are already in the room after connecting, fetch current participants after connect and handle them explicitly:
for p in ctx.room.participants.values():
on_participant_connected(p)
If you’d like, paste the updated snippet and I’ll review it.