Explain to me this line in docs class *JobContext*...
# ask-ai
r
Explain to me this line in docs class JobContext:
Copy code
prop room : rtc.Room
The Room object is the main interface that the worker should interact with.
When the entrypoint is called, the worker has not connected to the Room yet. Certain properties of Room would not be available before calling JobContext.connect()
t
Thanks for reaching out, Ivan. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Regarding the JobContext line you quoted: •
room: rtc.Room
is the LiveKit Room instance your worker will use to publish/subscribe tracks and manage participants. • At entrypoint time, the worker hasn’t joined the room yet. So APIs that rely on an active connection (e.g., accessing participants, publications, or publishing tracks) aren’t usable until you call
JobContext.connect()
. • Call
ctx.connect()
when you’re ready for the worker to join as a participant; you can do any pre-connection setup before that to avoid appearing in the room too early. For more detail, see Job lifecycle, External data and pre-connect setup, and general connecting behavior. Sources: Node.js Agents Architecture | livekit/livekit_composite | DeepWiki | Connecting to LiveKit | LiveKit docs | Core Platform Architecture & Authentication | livekit/livekit_composite | D... | External data and RAG | LiveKit Docs | Job lifecycle | LiveKit Docs