happy-night-10979
06/25/2025, 12:37 PM[12:04:28.956] INFO (616): job completed.
jobID: "AJ_Rs7FQ4WCsNxb"
[12:04:28.956] INFO (616): Job process shutdown
jobID: "AJ_Rs7FQ4WCsNxb"
tall-airline-16756
06/25/2025, 12:37 PMtall-airline-16756
06/25/2025, 12:38 PMReconnectPolicy
interface to control client reconnection behavior. This policy includes a method called nextRetryDelayInMs
, which determines the time interval between reconnection attempts. You can customize this interval by implementing the ReconnectPolicy
interface and adjusting the nextRetryDelayInMs
method. Returning null
from this method will stop reconnection attempts.
Deleting a Room on User Logout/Disconnection
When a user logs out or disconnects, you have two options:
1. Disconnect just the agent: This allows other participants to continue in the room. Use the following code: async def entrypoint(ctx: JobContext):
# do some work
...
# disconnect from the room
ctx.shutdown(reason="Session ended")
2. Delete the entire room: This disconnects everyone and removes the room from the server. Use the following code: from livekit import api
async def entrypoint(ctx: JobContext):
# do some work
...
api_client = api.LiveKitAPI(
os.getenv("LIVEKIT_URL"),
os.getenv("LIVEKIT_API_KEY"),
os.getenv("LIVEKIT_API_SECRET"),
)
await api_client.room.delete_room(api.DeleteRoomRequest(
room=ctx.job.room.name,
))
When you delete a room, a Disconnected
room event will be sent to all participants, and the room will be removed from the server.
If you need further assistance or clarification, feel free to ask!
Sources: GitHub::livekit::livekit_composite | livekit/client-sdk-swift/Sources/LiveK... | Inside a session | LiveKit Docs