Skip to main content
The idle timeout feature automatically ends a call session when you’re the only participant remaining. This prevents sessions from running indefinitely and consuming resources.

How It Works

  1. When all other participants leave, a countdown timer starts
  2. After the initial timeout period, a prompt is shown to the user
  3. If the user doesn’t respond, the session ends after the second timeout period

Configure Timeout Periods

Set the timeout periods when joining a session:
const callSettings = {
  idleTimeoutPeriodBeforePrompt: 60000,  // 60 seconds before showing prompt
  idleTimeoutPeriodAfterPrompt: 120000,  // 120 seconds after prompt before ending
  // ... other settings
};

await CometChatCalls.joinSession(callToken, callSettings, container);
PropertyTypeDefaultDescription
idleTimeoutPeriodBeforePromptNumber60000Time in milliseconds before showing the timeout prompt
idleTimeoutPeriodAfterPromptNumber120000Time in milliseconds after the prompt before ending the session

Session Timeout Event

Listen for when the session times out:
CometChatCalls.addEventListener("onSessionTimedOut", () => {
  console.log("Session ended due to inactivity");
  // Navigate away or show a message
});

Disable Idle Timeout

To effectively disable the idle timeout, set very long timeout periods:
const callSettings = {
  idleTimeoutPeriodBeforePrompt: 86400000,  // 24 hours
  idleTimeoutPeriodAfterPrompt: 86400000,   // 24 hours
  // ... other settings
};
The minimum value for idleTimeoutPeriodAfterPrompt is 60 seconds (60000 milliseconds).