@cometchat/skills 4.1.0 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/install.js +298 -41
- package/package.json +1 -1
- package/skills/cometchat/SKILL.md +146 -27
- package/skills/cometchat-a11y/SKILL.md +476 -0
- package/skills/cometchat-android-v5/SKILL.md +1 -1
- package/skills/cometchat-android-v5-calls/SKILL.md +413 -0
- package/skills/cometchat-android-v5-calls/references/README.md +53 -0
- package/skills/cometchat-android-v5-calls/references/add-calls-to-existing-chat.md +195 -0
- package/skills/cometchat-android-v5-calls/references/audio-controls.md +91 -0
- package/skills/cometchat-android-v5-calls/references/background-handling.md +168 -0
- package/skills/cometchat-android-v5-calls/references/call-layouts.md +123 -0
- package/skills/cometchat-android-v5-calls/references/call-logs.md +113 -0
- package/skills/cometchat-android-v5-calls/references/call-session.md +274 -0
- package/skills/cometchat-android-v5-calls/references/custom-ui.md +150 -0
- package/skills/cometchat-android-v5-calls/references/event-listeners.md +123 -0
- package/skills/cometchat-android-v5-calls/references/group-calls.md +205 -0
- package/skills/cometchat-android-v5-calls/references/idle-timeout.md +111 -0
- package/skills/cometchat-android-v5-calls/references/in-call-chat.md +134 -0
- package/skills/cometchat-android-v5-calls/references/join-session.md +120 -0
- package/skills/cometchat-android-v5-calls/references/migration-v4-to-v5.md +206 -0
- package/skills/cometchat-android-v5-calls/references/participant-management.md +110 -0
- package/skills/cometchat-android-v5-calls/references/picture-in-picture.md +106 -0
- package/skills/cometchat-android-v5-calls/references/raise-hand.md +242 -0
- package/skills/cometchat-android-v5-calls/references/recording.md +101 -0
- package/skills/cometchat-android-v5-calls/references/ringing-integration.md +152 -0
- package/skills/cometchat-android-v5-calls/references/screen-sharing.md +82 -0
- package/skills/cometchat-android-v5-calls/references/server-fcm-voip.md +215 -0
- package/skills/cometchat-android-v5-calls/references/session-settings.md +121 -0
- package/skills/cometchat-android-v5-calls/references/setup.md +137 -0
- package/skills/cometchat-android-v5-calls/references/share-invite.md +151 -0
- package/skills/cometchat-android-v5-calls/references/video-controls.md +87 -0
- package/skills/cometchat-android-v5-calls/references/voip-calling.md +526 -0
- package/skills/cometchat-android-v5-components/SKILL.md +1 -1
- package/skills/cometchat-android-v5-core/SKILL.md +1 -1
- package/skills/cometchat-android-v5-customization/SKILL.md +1 -1
- package/skills/cometchat-android-v5-extensions/SKILL.md +1 -1
- package/skills/cometchat-android-v5-features/SKILL.md +1 -1
- package/skills/cometchat-android-v5-placement/SKILL.md +1 -1
- package/skills/cometchat-android-v5-production/SKILL.md +1 -1
- package/skills/cometchat-android-v5-push/SKILL.md +1 -1
- package/skills/cometchat-android-v5-testing/SKILL.md +1 -1
- package/skills/cometchat-android-v5-theming/SKILL.md +1 -1
- package/skills/cometchat-android-v5-troubleshooting/SKILL.md +1 -1
- package/skills/cometchat-android-v6/SKILL.md +1 -1
- package/skills/cometchat-android-v6-builder-settings/SKILL.md +1 -1
- package/skills/cometchat-android-v6-calls/SKILL.md +375 -0
- package/skills/cometchat-android-v6-calls/references/add-calls-to-existing-chat.md +97 -0
- package/skills/cometchat-android-v6-calls/references/call-layouts.md +91 -0
- package/skills/cometchat-android-v6-calls/references/call-session.md +163 -0
- package/skills/cometchat-android-v6-calls/references/device-management.md +171 -0
- package/skills/cometchat-android-v6-calls/references/group-calls.md +191 -0
- package/skills/cometchat-android-v6-calls/references/idle-timeout.md +107 -0
- package/skills/cometchat-android-v6-calls/references/in-call-chat.md +136 -0
- package/skills/cometchat-android-v6-calls/references/raise-hand.md +186 -0
- package/skills/cometchat-android-v6-calls/references/ringing-integration.md +176 -0
- package/skills/cometchat-android-v6-calls/references/server-fcm-voip.md +127 -0
- package/skills/cometchat-android-v6-calls/references/share-invite.md +105 -0
- package/skills/cometchat-android-v6-compose-components/SKILL.md +2 -2
- package/skills/cometchat-android-v6-compose-customization/SKILL.md +1 -1
- package/skills/cometchat-android-v6-compose-placement/SKILL.md +1 -1
- package/skills/cometchat-android-v6-compose-theming/SKILL.md +1 -1
- package/skills/cometchat-android-v6-core/SKILL.md +1 -1
- package/skills/cometchat-android-v6-events/SKILL.md +1 -1
- package/skills/cometchat-android-v6-extensions/SKILL.md +1 -1
- package/skills/cometchat-android-v6-features/SKILL.md +1 -1
- package/skills/cometchat-android-v6-kotlin-components/SKILL.md +1 -1
- package/skills/cometchat-android-v6-kotlin-customization/SKILL.md +1 -1
- package/skills/cometchat-android-v6-kotlin-placement/SKILL.md +1 -1
- package/skills/cometchat-android-v6-kotlin-theming/SKILL.md +1 -1
- package/skills/cometchat-android-v6-migration/SKILL.md +398 -0
- package/skills/cometchat-android-v6-production/SKILL.md +1 -1
- package/skills/cometchat-android-v6-push/SKILL.md +1 -1
- package/skills/cometchat-android-v6-testing/SKILL.md +1 -1
- package/skills/cometchat-android-v6-troubleshooting/SKILL.md +1 -1
- package/skills/cometchat-angular-calls/SKILL.md +511 -0
- package/skills/cometchat-angular-calls/references/add-calls-to-existing-chat.md +95 -0
- package/skills/cometchat-angular-calls/references/call-layouts.md +106 -0
- package/skills/cometchat-angular-calls/references/call-session.md +167 -0
- package/skills/cometchat-angular-calls/references/custom-ui.md +231 -0
- package/skills/cometchat-angular-calls/references/device-management.md +135 -0
- package/skills/cometchat-angular-calls/references/group-calls.md +412 -0
- package/skills/cometchat-angular-calls/references/idle-timeout.md +145 -0
- package/skills/cometchat-angular-calls/references/in-call-chat.md +148 -0
- package/skills/cometchat-angular-calls/references/lazy-loading-pitfalls.md +205 -0
- package/skills/cometchat-angular-calls/references/migration-v4-to-v5.md +53 -0
- package/skills/cometchat-angular-calls/references/ngzone-and-async-callbacks.md +183 -0
- package/skills/cometchat-angular-calls/references/picture-in-picture.md +285 -0
- package/skills/cometchat-angular-calls/references/raise-hand.md +167 -0
- package/skills/cometchat-angular-calls/references/recording-screen-share.md +267 -0
- package/skills/cometchat-angular-calls/references/ringing-integration.md +131 -0
- package/skills/cometchat-angular-calls/references/server-web-push-vapid.md +100 -0
- package/skills/cometchat-angular-calls/references/share-invite.md +116 -0
- package/skills/cometchat-angular-components/SKILL.md +1 -1
- package/skills/cometchat-angular-core/SKILL.md +1 -1
- package/skills/cometchat-angular-customization/SKILL.md +1 -1
- package/skills/cometchat-angular-features/SKILL.md +1 -1
- package/skills/cometchat-angular-patterns/SKILL.md +1 -1
- package/skills/cometchat-angular-placement/SKILL.md +1 -1
- package/skills/cometchat-angular-production/SKILL.md +1 -1
- package/skills/cometchat-angular-push/SKILL.md +403 -0
- package/skills/cometchat-angular-testing/SKILL.md +333 -0
- package/skills/cometchat-angular-theming/SKILL.md +1 -1
- package/skills/cometchat-angular-troubleshooting/SKILL.md +1 -1
- package/skills/cometchat-astro-patterns/SKILL.md +1 -1
- package/skills/cometchat-calls/SKILL.md +358 -0
- package/skills/cometchat-calls/references/use-case-broadcast.md +194 -0
- package/skills/cometchat-calls/references/use-case-marketplace.md +158 -0
- package/skills/cometchat-calls/references/use-case-support.md +190 -0
- package/skills/cometchat-calls/references/use-case-team.md +169 -0
- package/skills/cometchat-calls/references/use-case-telehealth.md +154 -0
- package/skills/cometchat-components/SKILL.md +1 -1
- package/skills/cometchat-core/SKILL.md +1 -1
- package/skills/cometchat-customization/SKILL.md +2 -2
- package/skills/cometchat-features/SKILL.md +2 -2
- package/skills/cometchat-flutter-v5/SKILL.md +1 -1
- package/skills/cometchat-flutter-v5-calls/SKILL.md +325 -94
- package/skills/cometchat-flutter-v5-calls/references/add-calls-to-existing-chat.md +169 -0
- package/skills/cometchat-flutter-v5-calls/references/call-layouts.md +98 -0
- package/skills/cometchat-flutter-v5-calls/references/call-session.md +330 -0
- package/skills/cometchat-flutter-v5-calls/references/device-management.md +120 -0
- package/skills/cometchat-flutter-v5-calls/references/group-calls.md +187 -0
- package/skills/cometchat-flutter-v5-calls/references/idle-timeout.md +97 -0
- package/skills/cometchat-flutter-v5-calls/references/in-call-chat.md +132 -0
- package/skills/cometchat-flutter-v5-calls/references/migration-v4-to-v5.md +160 -0
- package/skills/cometchat-flutter-v5-calls/references/raise-hand.md +244 -0
- package/skills/cometchat-flutter-v5-calls/references/ringing-integration.md +193 -0
- package/skills/cometchat-flutter-v5-calls/references/server-push-bridge.md +101 -0
- package/skills/cometchat-flutter-v5-calls/references/share-invite.md +142 -0
- package/skills/cometchat-flutter-v5-conversations/SKILL.md +1 -1
- package/skills/cometchat-flutter-v5-core/SKILL.md +1 -1
- package/skills/cometchat-flutter-v5-customization/SKILL.md +1 -1
- package/skills/cometchat-flutter-v5-events/SKILL.md +1 -1
- package/skills/cometchat-flutter-v5-messages/SKILL.md +1 -1
- package/skills/cometchat-flutter-v5-production/SKILL.md +1 -1
- package/skills/cometchat-flutter-v5-push/SKILL.md +1 -1
- package/skills/cometchat-flutter-v5-testing/SKILL.md +390 -0
- package/skills/cometchat-flutter-v5-theming/SKILL.md +1 -1
- package/skills/cometchat-flutter-v5-troubleshooting/SKILL.md +1 -1
- package/skills/cometchat-flutter-v5-users-groups/SKILL.md +1 -1
- package/skills/cometchat-flutter-v6/SKILL.md +1 -1
- package/skills/cometchat-flutter-v6-calls/SKILL.md +308 -243
- package/skills/cometchat-flutter-v6-calls/references/add-calls-to-existing-chat.md +134 -0
- package/skills/cometchat-flutter-v6-calls/references/call-layouts.md +102 -0
- package/skills/cometchat-flutter-v6-calls/references/call-session.md +229 -0
- package/skills/cometchat-flutter-v6-calls/references/device-management.md +99 -0
- package/skills/cometchat-flutter-v6-calls/references/group-calls.md +190 -0
- package/skills/cometchat-flutter-v6-calls/references/idle-timeout.md +80 -0
- package/skills/cometchat-flutter-v6-calls/references/in-call-chat.md +122 -0
- package/skills/cometchat-flutter-v6-calls/references/raise-hand.md +268 -0
- package/skills/cometchat-flutter-v6-calls/references/ringing-integration.md +171 -0
- package/skills/cometchat-flutter-v6-calls/references/server-push-bridge.md +93 -0
- package/skills/cometchat-flutter-v6-calls/references/share-invite.md +102 -0
- package/skills/cometchat-flutter-v6-components/SKILL.md +1 -1
- package/skills/cometchat-flutter-v6-conversations/SKILL.md +1 -1
- package/skills/cometchat-flutter-v6-core/SKILL.md +1 -1
- package/skills/cometchat-flutter-v6-customization/SKILL.md +1 -1
- package/skills/cometchat-flutter-v6-events/SKILL.md +1 -1
- package/skills/cometchat-flutter-v6-features/SKILL.md +1 -1
- package/skills/cometchat-flutter-v6-messages/SKILL.md +1 -1
- package/skills/cometchat-flutter-v6-migration/SKILL.md +1 -1
- package/skills/cometchat-flutter-v6-placement/SKILL.md +1 -1
- package/skills/cometchat-flutter-v6-production/SKILL.md +1 -1
- package/skills/cometchat-flutter-v6-push/SKILL.md +452 -0
- package/skills/cometchat-flutter-v6-testing/SKILL.md +319 -0
- package/skills/cometchat-flutter-v6-theming/SKILL.md +1 -1
- package/skills/cometchat-flutter-v6-troubleshooting/SKILL.md +1 -1
- package/skills/cometchat-flutter-v6-users-groups/SKILL.md +1 -1
- package/skills/cometchat-i18n/SKILL.md +358 -0
- package/skills/cometchat-ios/SKILL.md +5 -5
- package/skills/cometchat-ios-calls/SKILL.md +409 -0
- package/skills/cometchat-ios-calls/references/add-calls-to-existing-chat.md +172 -0
- package/skills/cometchat-ios-calls/references/avaudiosession-routing.md +189 -0
- package/skills/cometchat-ios-calls/references/call-layouts.md +136 -0
- package/skills/cometchat-ios-calls/references/call-session.md +221 -0
- package/skills/cometchat-ios-calls/references/callkit-and-pushkit.md +353 -0
- package/skills/cometchat-ios-calls/references/custom-ui.md +322 -0
- package/skills/cometchat-ios-calls/references/device-management.md +171 -0
- package/skills/cometchat-ios-calls/references/group-calls.md +396 -0
- package/skills/cometchat-ios-calls/references/idle-timeout.md +185 -0
- package/skills/cometchat-ios-calls/references/in-call-chat.md +183 -0
- package/skills/cometchat-ios-calls/references/migration-v4-to-v5.md +138 -0
- package/skills/cometchat-ios-calls/references/picture-in-picture.md +246 -0
- package/skills/cometchat-ios-calls/references/raise-hand.md +239 -0
- package/skills/cometchat-ios-calls/references/recording-screen-share.md +339 -0
- package/skills/cometchat-ios-calls/references/ringing-integration.md +142 -0
- package/skills/cometchat-ios-calls/references/server-apns-pushkit.md +267 -0
- package/skills/cometchat-ios-calls/references/share-invite.md +152 -0
- package/skills/cometchat-ios-calls/references/swiftui-uikit-hosting.md +246 -0
- package/skills/cometchat-ios-calls/references/voip-cert-setup.md +166 -0
- package/skills/cometchat-ios-components/SKILL.md +1 -1
- package/skills/cometchat-ios-core/SKILL.md +1 -1
- package/skills/cometchat-ios-customization/SKILL.md +1 -1
- package/skills/cometchat-ios-features/SKILL.md +1 -1
- package/skills/cometchat-ios-placement/SKILL.md +1 -1
- package/skills/cometchat-ios-production/SKILL.md +1 -1
- package/skills/cometchat-ios-push/SKILL.md +1 -1
- package/skills/cometchat-ios-testing/SKILL.md +371 -0
- package/skills/cometchat-ios-theming/SKILL.md +1 -1
- package/skills/cometchat-ios-troubleshooting/SKILL.md +1 -1
- package/skills/cometchat-native-bare-patterns/SKILL.md +45 -3
- package/skills/cometchat-native-calls/SKILL.md +599 -0
- package/skills/cometchat-native-calls/references/add-calls-to-existing-chat.md +203 -0
- package/skills/cometchat-native-calls/references/call-layouts.md +124 -0
- package/skills/cometchat-native-calls/references/call-session.md +182 -0
- package/skills/cometchat-native-calls/references/custom-ui.md +250 -0
- package/skills/cometchat-native-calls/references/device-management.md +135 -0
- package/skills/cometchat-native-calls/references/expo-vs-bare.md +179 -0
- package/skills/cometchat-native-calls/references/group-calls.md +291 -0
- package/skills/cometchat-native-calls/references/idle-timeout.md +128 -0
- package/skills/cometchat-native-calls/references/in-call-chat.md +143 -0
- package/skills/cometchat-native-calls/references/migration-v4-to-v5.md +72 -0
- package/skills/cometchat-native-calls/references/picture-in-picture.md +276 -0
- package/skills/cometchat-native-calls/references/raise-hand.md +203 -0
- package/skills/cometchat-native-calls/references/recording-screen-share.md +290 -0
- package/skills/cometchat-native-calls/references/ringing-integration.md +118 -0
- package/skills/cometchat-native-calls/references/server-push-bridge.md +135 -0
- package/skills/cometchat-native-calls/references/server-push-payloads.md +193 -0
- package/skills/cometchat-native-calls/references/share-invite.md +144 -0
- package/skills/cometchat-native-calls/references/voip-push-end-to-end.md +317 -0
- package/skills/cometchat-native-components/SKILL.md +1 -1
- package/skills/cometchat-native-core/SKILL.md +1 -1
- package/skills/cometchat-native-customization/SKILL.md +1 -1
- package/skills/cometchat-native-expo-patterns/SKILL.md +18 -1
- package/skills/cometchat-native-features/SKILL.md +1 -1
- package/skills/cometchat-native-placement/SKILL.md +1 -1
- package/skills/cometchat-native-production/SKILL.md +1 -1
- package/skills/cometchat-native-push/SKILL.md +1 -1
- package/skills/cometchat-native-testing/SKILL.md +1 -1
- package/skills/cometchat-native-theming/SKILL.md +1 -1
- package/skills/cometchat-native-troubleshooting/SKILL.md +1 -1
- package/skills/cometchat-nextjs-patterns/SKILL.md +1 -1
- package/skills/cometchat-placement/SKILL.md +1 -1
- package/skills/cometchat-production/SKILL.md +1 -1
- package/skills/cometchat-react-calls/SKILL.md +539 -0
- package/skills/cometchat-react-calls/references/add-calls-to-existing-chat.md +145 -0
- package/skills/cometchat-react-calls/references/call-layouts.md +161 -0
- package/skills/cometchat-react-calls/references/call-session.md +235 -0
- package/skills/cometchat-react-calls/references/custom-ui.md +201 -0
- package/skills/cometchat-react-calls/references/device-management.md +206 -0
- package/skills/cometchat-react-calls/references/group-calls.md +262 -0
- package/skills/cometchat-react-calls/references/idle-timeout.md +175 -0
- package/skills/cometchat-react-calls/references/in-call-chat.md +212 -0
- package/skills/cometchat-react-calls/references/migration-v4-to-v5.md +172 -0
- package/skills/cometchat-react-calls/references/picture-in-picture.md +245 -0
- package/skills/cometchat-react-calls/references/raise-hand.md +238 -0
- package/skills/cometchat-react-calls/references/recording-screen-share.md +143 -0
- package/skills/cometchat-react-calls/references/ringing-integration.md +255 -0
- package/skills/cometchat-react-calls/references/server-web-push-vapid.md +241 -0
- package/skills/cometchat-react-calls/references/share-invite.md +176 -0
- package/skills/cometchat-react-calls/references/testing-calls-on-web.md +198 -0
- package/skills/cometchat-react-calls/references/voip-and-web-push.md +165 -0
- package/skills/cometchat-react-patterns/SKILL.md +1 -1
- package/skills/cometchat-react-push/SKILL.md +448 -0
- package/skills/cometchat-react-router-patterns/SKILL.md +1 -1
- package/skills/cometchat-react-testing/SKILL.md +404 -0
- package/skills/cometchat-theming/SKILL.md +3 -3
- package/skills/cometchat-troubleshooting/SKILL.md +2 -2
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
# Idle timeout on web
|
|
2
|
+
|
|
3
|
+
Auto-ends calls where the local user is the only remaining participant. Two timers: a "you're alone, are you still there?" prompt fires after the first interval, then the session ends if the user doesn't respond before the second interval. SDK first-party — just two settings keys + one event.
|
|
4
|
+
|
|
5
|
+
**Canonical docs:** https://www.cometchat.com/docs/calls/javascript/idle-timeout
|
|
6
|
+
**Use it for:** any group call (preventing zombie sessions when everyone else hangs up), waiting rooms (auto-close empty rooms), classroom calls (instructor's screen doesn't stay live overnight).
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## SDK API
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
const settings = new CometChatCalls.CallSettingsBuilder()
|
|
14
|
+
.setSessionID(sessionId)
|
|
15
|
+
.setIdleTimeoutPeriodBeforePrompt(60_000) // 60s — first warning fires
|
|
16
|
+
.setIdleTimeoutPeriodAfterPrompt(120_000) // 120s — session ends if no response
|
|
17
|
+
.build();
|
|
18
|
+
|
|
19
|
+
CometChatCalls.addEventListener("onSessionTimedOut", () => {
|
|
20
|
+
// Navigate away, show "session ended" UI
|
|
21
|
+
});
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
| Setting | Default | Min | Use case |
|
|
25
|
+
|---|---|---|---|
|
|
26
|
+
| `idleTimeoutPeriodBeforePrompt` | 60_000 (60s) | 0 (immediate) | Time alone before the "still there?" prompt |
|
|
27
|
+
| `idleTimeoutPeriodAfterPrompt` | 120_000 (120s) | 60_000 (60s) | Grace period after the prompt before forced disconnect |
|
|
28
|
+
|
|
29
|
+
The SDK shows the prompt overlay automatically (kit's default UI). For custom UI you handle the prompt yourself.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Recommended timeouts per app archetype
|
|
34
|
+
|
|
35
|
+
| App | Before-prompt | After-prompt | Why |
|
|
36
|
+
|---|---|---|---|
|
|
37
|
+
| Marketplace 1:1 | 30s | 60s | Buyers lose interest fast; reclaim resources |
|
|
38
|
+
| Telehealth (provider waiting) | 5min | 5min | Patients run late; don't punish them |
|
|
39
|
+
| Classroom / instructor | 10min | 10min | Instructor may step away; don't interrupt class |
|
|
40
|
+
| Internal team meeting | 60s | 120s | Default — meetings end abruptly anyway |
|
|
41
|
+
| Customer support | 30s | 60s | Agent moves to next ticket; reclaim |
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Custom prompt UI (when default isn't enough)
|
|
46
|
+
|
|
47
|
+
The kit's default prompt is functional but plain. Custom UI uses `enableDefaultLayout(false)` + listens for the prompt internally — though the SDK doesn't expose a direct "prompt fired" event. Two patterns:
|
|
48
|
+
|
|
49
|
+
### Pattern A — Track time-since-alone yourself
|
|
50
|
+
|
|
51
|
+
```tsx
|
|
52
|
+
import { useEffect, useRef, useState } from "react";
|
|
53
|
+
import { CometChatCalls } from "@cometchat/calls-sdk-javascript";
|
|
54
|
+
|
|
55
|
+
function useIdleTimeoutPrompt({
|
|
56
|
+
beforePromptMs = 60_000,
|
|
57
|
+
afterPromptMs = 120_000,
|
|
58
|
+
}: { beforePromptMs?: number; afterPromptMs?: number; }) {
|
|
59
|
+
const [showPrompt, setShowPrompt] = useState(false);
|
|
60
|
+
const aloneSinceRef = useRef<number | null>(null);
|
|
61
|
+
const promptTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
62
|
+
const sessionTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
63
|
+
|
|
64
|
+
useEffect(() => {
|
|
65
|
+
const listener = new CometChatCalls.OngoingCallListener({
|
|
66
|
+
onUserListUpdated: (users: { uid: string }[]) => {
|
|
67
|
+
const localUid = CometChat.getLoggedinUser()?.getUid();
|
|
68
|
+
const remoteCount = users.filter(u => u.uid !== localUid).length;
|
|
69
|
+
|
|
70
|
+
if (remoteCount === 0 && aloneSinceRef.current === null) {
|
|
71
|
+
// Just became alone
|
|
72
|
+
aloneSinceRef.current = Date.now();
|
|
73
|
+
promptTimerRef.current = setTimeout(() => {
|
|
74
|
+
setShowPrompt(true);
|
|
75
|
+
sessionTimerRef.current = setTimeout(() => {
|
|
76
|
+
CometChatCalls.leaveSession();
|
|
77
|
+
}, afterPromptMs);
|
|
78
|
+
}, beforePromptMs);
|
|
79
|
+
} else if (remoteCount > 0) {
|
|
80
|
+
// Someone joined — clear timers
|
|
81
|
+
aloneSinceRef.current = null;
|
|
82
|
+
if (promptTimerRef.current) clearTimeout(promptTimerRef.current);
|
|
83
|
+
if (sessionTimerRef.current) clearTimeout(sessionTimerRef.current);
|
|
84
|
+
setShowPrompt(false);
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
// Attach listener... (see custom-ui.md for the full setup)
|
|
90
|
+
|
|
91
|
+
return () => {
|
|
92
|
+
if (promptTimerRef.current) clearTimeout(promptTimerRef.current);
|
|
93
|
+
if (sessionTimerRef.current) clearTimeout(sessionTimerRef.current);
|
|
94
|
+
};
|
|
95
|
+
}, [beforePromptMs, afterPromptMs]);
|
|
96
|
+
|
|
97
|
+
function dismiss() {
|
|
98
|
+
setShowPrompt(false);
|
|
99
|
+
if (sessionTimerRef.current) clearTimeout(sessionTimerRef.current);
|
|
100
|
+
aloneSinceRef.current = null;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return { showPrompt, dismiss };
|
|
104
|
+
}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Usage:
|
|
108
|
+
|
|
109
|
+
```tsx
|
|
110
|
+
function CustomCallView() {
|
|
111
|
+
const { showPrompt, dismiss } = useIdleTimeoutPrompt({
|
|
112
|
+
beforePromptMs: 30_000,
|
|
113
|
+
afterPromptMs: 60_000,
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
return (
|
|
117
|
+
<>
|
|
118
|
+
{/* call UI */}
|
|
119
|
+
{showPrompt && (
|
|
120
|
+
<div role="alertdialog" aria-modal="true" aria-labelledby="idle-title">
|
|
121
|
+
<h2 id="idle-title">Still there?</h2>
|
|
122
|
+
<p>You're alone in this call. It'll end in 60 seconds.</p>
|
|
123
|
+
<button onClick={dismiss}>Stay</button>
|
|
124
|
+
<button onClick={() => CometChatCalls.leaveSession()}>End now</button>
|
|
125
|
+
</div>
|
|
126
|
+
)}
|
|
127
|
+
</>
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Pattern B — Long timeouts + custom prompt only
|
|
133
|
+
|
|
134
|
+
```ts
|
|
135
|
+
const settings = new CometChatCalls.CallSettingsBuilder()
|
|
136
|
+
.setIdleTimeoutPeriodBeforePrompt(86_400_000) // 24 hours — effectively disabled
|
|
137
|
+
.setIdleTimeoutPeriodAfterPrompt(86_400_000)
|
|
138
|
+
.build();
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Then implement your own timeout via Pattern A. Useful when you want UX-customized prompts instead of the SDK's default overlay.
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## Anti-patterns
|
|
146
|
+
|
|
147
|
+
1. **`idleTimeoutPeriodAfterPrompt < 60_000` (60s).** SDK rejects values below 60s. Setting it lower silently fails — the SDK uses 60s instead.
|
|
148
|
+
2. **Disabling idle timeout entirely** by setting both timers to `Infinity`. Sessions hang forever, server-side resources leak, billing dings you. Always set a reasonable upper bound.
|
|
149
|
+
3. **Showing the prompt at the same time as call notifications/banners.** Stacks on top of incoming-message notifications. Z-index conflicts. Render the idle prompt at the highest z-level for the call surface.
|
|
150
|
+
4. **Auto-ending without a goodbye animation.** Jarring. Fade-out the call surface over 500ms before disconnecting.
|
|
151
|
+
5. **Prompt UI without `role="alertdialog"`.** Screen readers don't pause to announce; user gets disconnected mid-listen. Use `role="alertdialog"` + `aria-modal="true"`.
|
|
152
|
+
6. **Restarting `aloneSinceRef.current` on EVERY participant change.** Want to track "alone since" only when transitioning from N>0 to 0. Don't reset when participants join/leave while still N>0.
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## Verification checklist
|
|
157
|
+
|
|
158
|
+
- [ ] `setIdleTimeoutPeriodBeforePrompt` + `setIdleTimeoutPeriodAfterPrompt` set on CallSettings
|
|
159
|
+
- [ ] After-prompt period ≥ 60_000 (60s)
|
|
160
|
+
- [ ] `onSessionTimedOut` event handler navigates away cleanly (not just `console.log`)
|
|
161
|
+
- [ ] Custom prompt UI uses `role="alertdialog"` + `aria-modal="true"`
|
|
162
|
+
- [ ] Custom prompt has both "Stay" and "End now" buttons
|
|
163
|
+
- [ ] Timer cleanup in `useEffect` return — no leaked setTimeout
|
|
164
|
+
- [ ] Browser smoke: 2 tabs in call, close tab B, watch tab A's timer fire (set short timeouts for testing)
|
|
165
|
+
- [ ] After-prompt smoke: dismiss the prompt → timer clears → no auto-disconnect
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## Pointers
|
|
170
|
+
|
|
171
|
+
- `cometchat-react-calls` SKILL.md — the seven hard rules
|
|
172
|
+
- `references/group-calls.md` — group call architecture (idle-timeout matters most for groups)
|
|
173
|
+
- `references/custom-ui.md` — custom call UI integration
|
|
174
|
+
- `cometchat-a11y` — `role="alertdialog"` patterns
|
|
175
|
+
- Canonical docs: https://www.cometchat.com/docs/calls/javascript/idle-timeout
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
# In-call chat on web
|
|
2
|
+
|
|
3
|
+
Text messaging during a video/voice call. SDK provides the chat button in the control panel + events; the actual chat UI is yours to build (the kit's existing `<CometChatMessageList>` + `<CometChatMessageComposer>` work great here).
|
|
4
|
+
|
|
5
|
+
**Canonical docs:** https://www.cometchat.com/docs/calls/javascript/in-call-chat
|
|
6
|
+
**Use it for:** classroom side chat, team meeting links/notes, customer support secondary channel, AV-impaired participant text fallback.
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## SDK API
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
const settings = new CometChatCalls.CallSettingsBuilder()
|
|
14
|
+
.setSessionID(sessionId)
|
|
15
|
+
.hideChatButton(false) // show the kit's built-in chat button
|
|
16
|
+
.build();
|
|
17
|
+
|
|
18
|
+
CometChatCalls.addEventListener("onChatButtonClicked", () => {
|
|
19
|
+
// Open your chat panel
|
|
20
|
+
setChatOpen(true);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
// Update unread badge
|
|
24
|
+
CometChatCalls.setChatButtonUnreadCount(5);
|
|
25
|
+
CometChatCalls.setChatButtonUnreadCount(0); // clear
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
The button + badge live on the SDK's control panel. Your job is to render the chat UI when the button is tapped.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Architecture: group-as-session
|
|
33
|
+
|
|
34
|
+
The recommended pattern: use a CometChat **group** keyed to the call session. Every participant joins the group when they join the call; messages flow through the group's normal CometChat Chat SDK channel. When the call ends, the group either persists (logged history) or is deleted (ephemeral).
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
import { CometChat } from "@cometchat/chat-sdk-javascript";
|
|
38
|
+
|
|
39
|
+
async function ensureCallGroup(sessionId: string): Promise<CometChat.Group> {
|
|
40
|
+
// Try to get existing
|
|
41
|
+
try {
|
|
42
|
+
return await CometChat.getGroup(sessionId);
|
|
43
|
+
} catch {
|
|
44
|
+
// Create
|
|
45
|
+
const group = new CometChat.Group(
|
|
46
|
+
sessionId, // GUID == session ID
|
|
47
|
+
`Call ${sessionId}`, // display name
|
|
48
|
+
CometChat.GROUP_TYPE.PUBLIC, // anyone in the call can join
|
|
49
|
+
);
|
|
50
|
+
return await CometChat.createGroup(group);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
async function joinCallGroup(sessionId: string): Promise<void> {
|
|
55
|
+
await CometChat.joinGroup(sessionId, CometChat.GROUP_TYPE.PUBLIC, "");
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Wire this into your call-start flow: after `startSession` succeeds, `joinCallGroup`.
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Chat panel UI
|
|
64
|
+
|
|
65
|
+
```tsx
|
|
66
|
+
import { useState, useEffect } from "react";
|
|
67
|
+
import { CometChat } from "@cometchat/chat-sdk-javascript";
|
|
68
|
+
import { CometChatCalls } from "@cometchat/calls-sdk-javascript";
|
|
69
|
+
import {
|
|
70
|
+
CometChatMessageList,
|
|
71
|
+
CometChatMessageComposer,
|
|
72
|
+
} from "@cometchat/chat-uikit-react";
|
|
73
|
+
|
|
74
|
+
interface InCallChatPanelProps {
|
|
75
|
+
sessionId: string;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function InCallChatPanel({ sessionId }: InCallChatPanelProps) {
|
|
79
|
+
const [open, setOpen] = useState(false);
|
|
80
|
+
const [unread, setUnread] = useState(0);
|
|
81
|
+
const [group, setGroup] = useState<CometChat.Group>();
|
|
82
|
+
|
|
83
|
+
// Listen for the SDK's button click
|
|
84
|
+
useEffect(() => {
|
|
85
|
+
const handler = () => setOpen(true);
|
|
86
|
+
CometChatCalls.addEventListener("onChatButtonClicked", handler);
|
|
87
|
+
return () => CometChatCalls.removeEventListener("onChatButtonClicked", handler);
|
|
88
|
+
}, []);
|
|
89
|
+
|
|
90
|
+
// Resolve the group object for the message list
|
|
91
|
+
useEffect(() => {
|
|
92
|
+
CometChat.getGroup(sessionId).then(setGroup).catch(() => {});
|
|
93
|
+
}, [sessionId]);
|
|
94
|
+
|
|
95
|
+
// Track unread when panel is closed
|
|
96
|
+
useEffect(() => {
|
|
97
|
+
const listenerId = `in-call-chat-${sessionId}`;
|
|
98
|
+
const messageListener = new CometChat.MessageListener({
|
|
99
|
+
onTextMessageReceived: (msg: CometChat.TextMessage) => {
|
|
100
|
+
if (
|
|
101
|
+
msg.getReceiverType() === CometChat.RECEIVER_TYPE.GROUP &&
|
|
102
|
+
msg.getReceiverId() === sessionId &&
|
|
103
|
+
!open
|
|
104
|
+
) {
|
|
105
|
+
setUnread((u) => {
|
|
106
|
+
const next = u + 1;
|
|
107
|
+
CometChatCalls.setChatButtonUnreadCount(next);
|
|
108
|
+
return next;
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
});
|
|
113
|
+
CometChat.addMessageListener(listenerId, messageListener);
|
|
114
|
+
return () => CometChat.removeMessageListener(listenerId);
|
|
115
|
+
}, [sessionId, open]);
|
|
116
|
+
|
|
117
|
+
// Clear badge on open
|
|
118
|
+
useEffect(() => {
|
|
119
|
+
if (open) {
|
|
120
|
+
setUnread(0);
|
|
121
|
+
CometChatCalls.setChatButtonUnreadCount(0);
|
|
122
|
+
}
|
|
123
|
+
}, [open]);
|
|
124
|
+
|
|
125
|
+
if (!open || !group) return null;
|
|
126
|
+
|
|
127
|
+
return (
|
|
128
|
+
<div
|
|
129
|
+
role="dialog"
|
|
130
|
+
aria-label="In-call chat"
|
|
131
|
+
style={{
|
|
132
|
+
position: "fixed",
|
|
133
|
+
right: 0,
|
|
134
|
+
top: 0,
|
|
135
|
+
bottom: 0,
|
|
136
|
+
width: 360,
|
|
137
|
+
background: "var(--cometchat-background-color-01)",
|
|
138
|
+
borderLeft: "1px solid var(--cometchat-border-color-light)",
|
|
139
|
+
display: "flex",
|
|
140
|
+
flexDirection: "column",
|
|
141
|
+
zIndex: 200,
|
|
142
|
+
}}
|
|
143
|
+
>
|
|
144
|
+
<div style={{ padding: "12px 16px", borderBottom: "1px solid var(--cometchat-border-color-light)", display: "flex", justifyContent: "space-between", alignItems: "center" }}>
|
|
145
|
+
<strong>Chat</strong>
|
|
146
|
+
<button onClick={() => setOpen(false)} aria-label="Close chat">×</button>
|
|
147
|
+
</div>
|
|
148
|
+
{/* The flex-1 + minHeight:0 dance applies here too — long chat → composer would push down */}
|
|
149
|
+
<div style={{ flex: "1 1 0", minHeight: 0, overflow: "hidden" }}>
|
|
150
|
+
<CometChatMessageList group={group} hideReplyInThreadOption />
|
|
151
|
+
</div>
|
|
152
|
+
<div style={{ flex: "0 0 auto" }}>
|
|
153
|
+
<CometChatMessageComposer group={group} />
|
|
154
|
+
</div>
|
|
155
|
+
</div>
|
|
156
|
+
);
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
The flex-1 + minHeight:0 + wrap-each-component pattern from `cometchat-react-patterns` rule 6a applies inside the chat panel too.
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## Compact UX patterns
|
|
165
|
+
|
|
166
|
+
For 1:1 calls or small groups, an in-call chat panel is overkill. Two lighter patterns:
|
|
167
|
+
|
|
168
|
+
### A — Floating message strip (top of call)
|
|
169
|
+
|
|
170
|
+
Show only the latest message inline; tap to open full chat. Minimal UI for "just the gist."
|
|
171
|
+
|
|
172
|
+
### B — System-toast on each message
|
|
173
|
+
|
|
174
|
+
`onTextMessageReceived` → toast at top of call. Auto-dismiss after 4s. No persistent panel.
|
|
175
|
+
|
|
176
|
+
The full panel pattern above is for 5+-person calls or when chat is a load-bearing part of the experience (e.g. classroom Q&A).
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## Anti-patterns
|
|
181
|
+
|
|
182
|
+
1. **Polling for unread count.** SDK's `setChatButtonUnreadCount` is push-based; respond to message events.
|
|
183
|
+
2. **Chat panel grows past viewport on long sessions.** flex-shrink trap (see `cometchat-react-patterns` rule 6a).
|
|
184
|
+
3. **Forgetting to clear the unread badge on panel open.** User opens, sees "12 new" badge that doesn't update — looks broken.
|
|
185
|
+
4. **Persisting the call group forever.** For ephemeral calls (consultations, support), delete the group on call end. Hosts of recurring meetings keep groups.
|
|
186
|
+
5. **Sending messages without auth.** Make sure CometChat.login resolved before joining the group. Race conditions on early call accept.
|
|
187
|
+
6. **Reusing one chat-panel instance across multiple calls.** Group reference goes stale. Re-mount per call.
|
|
188
|
+
|
|
189
|
+
---
|
|
190
|
+
|
|
191
|
+
## Verification checklist
|
|
192
|
+
|
|
193
|
+
- [ ] `hideChatButton: false` in CallSettings
|
|
194
|
+
- [ ] `onChatButtonClicked` listener opens the panel
|
|
195
|
+
- [ ] CometChat group created/resolved with sessionId as GUID
|
|
196
|
+
- [ ] Local user joins the group on call start
|
|
197
|
+
- [ ] Unread badge updates from `onTextMessageReceived` only when panel closed
|
|
198
|
+
- [ ] Badge cleared on panel open
|
|
199
|
+
- [ ] Chat panel uses flex-1 + minHeight:0 + wrap-each-component pattern
|
|
200
|
+
- [ ] `role="dialog"` + `aria-label` on the panel container
|
|
201
|
+
- [ ] Cleanup: remove message + chat-button listeners on call end
|
|
202
|
+
- [ ] Browser smoke: 2 tabs in call, send message from A → unread badge in B → tap → message visible
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
## Pointers
|
|
207
|
+
|
|
208
|
+
- `cometchat-react-calls` SKILL.md
|
|
209
|
+
- `cometchat-react-patterns` — minHeight:0 rule 6a (applies to in-call chat panel)
|
|
210
|
+
- `references/group-calls.md` — group call architecture
|
|
211
|
+
- `cometchat-android-v5-calls/references/in-call-chat.md` — Android V5 sibling reference
|
|
212
|
+
- Canonical docs: https://www.cometchat.com/docs/calls/javascript/in-call-chat
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
# Calls SDK v4 → v5 migration (web)
|
|
2
|
+
|
|
3
|
+
CometChat Calls SDK v5 is a **drop-in replacement** for v4 — bump the package, your existing code keeps working through deprecation shims. Migrate to v5 APIs to get granular event listeners, simpler init, and strongly-typed enums.
|
|
4
|
+
|
|
5
|
+
**Canonical docs:** https://www.cometchat.com/docs/calls/javascript/migration-guide-v5
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Step 1 — Bump the package
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @cometchat/calls-sdk-javascript@5
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
If you're using CometChat UI Kits, this is enough — the kit's calls integration uses the v4 deprecated layer. **You can ship to production at this step** and migrate v5 APIs incrementally.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Step 2 — Migrate init (optional but cleaner)
|
|
20
|
+
|
|
21
|
+
```diff
|
|
22
|
+
- const callAppSettings = new CometChatCalls.CallAppSettingsBuilder()
|
|
23
|
+
- .setAppId("APP_ID")
|
|
24
|
+
- .setRegion("REGION")
|
|
25
|
+
- .build();
|
|
26
|
+
- await CometChatCalls.init(callAppSettings);
|
|
27
|
+
|
|
28
|
+
+ await CometChatCalls.init({ appId: "APP_ID", region: "REGION" });
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Step 3 — Add `login()` after Chat SDK login
|
|
34
|
+
|
|
35
|
+
v5 introduces a dedicated Calls SDK auth step. After the user logs into the Chat SDK, call:
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
const authToken = (await CometChat.getLoggedinUser())!.getAuthToken();
|
|
39
|
+
await CometChatCalls.login(authToken);
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
After this, `generateToken()` and `joinSession()` no longer need an authToken parameter.
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Step 4 — Migrate session settings to plain object
|
|
47
|
+
|
|
48
|
+
```diff
|
|
49
|
+
- const callSettings = new CometChatCalls.CallSettingsBuilder()
|
|
50
|
+
- .setIsAudioOnlyCall(true)
|
|
51
|
+
- .showRecordingButton(true)
|
|
52
|
+
- .startWithAudioMuted(false)
|
|
53
|
+
- .build();
|
|
54
|
+
|
|
55
|
+
+ const sessionSettings = {
|
|
56
|
+
+ sessionType: "VOICE", // was setIsAudioOnlyCall(true)
|
|
57
|
+
+ hideRecordingButton: false, // was showRecordingButton(true) — INVERTED
|
|
58
|
+
+ startAudioMuted: false,
|
|
59
|
+
+ layout: "TILE",
|
|
60
|
+
+ };
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
**Watch out:** the boolean logic is **inverted** for many settings (v4 `show*` → v5 `hide*`). Search-and-replace doesn't work — review each manually.
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## Step 5 — Migrate events to granular listeners
|
|
68
|
+
|
|
69
|
+
```diff
|
|
70
|
+
- const callSettings = new CometChatCalls.CallSettingsBuilder()
|
|
71
|
+
- .setCallListener(new CometChatCalls.OngoingCallListener({
|
|
72
|
+
- onCallEnded: () => { /* ... */ },
|
|
73
|
+
- onUserJoined: (user) => { /* ... */ },
|
|
74
|
+
- onUserLeft: (user) => { /* ... */ },
|
|
75
|
+
- onError: (error) => { /* ... */ },
|
|
76
|
+
- }))
|
|
77
|
+
- .build();
|
|
78
|
+
|
|
79
|
+
+ const unsub1 = CometChatCalls.addEventListener("onSessionLeft", () => { /* ... */ });
|
|
80
|
+
+ const unsub2 = CometChatCalls.addEventListener("onParticipantJoined", (p) => { /* ... */ });
|
|
81
|
+
+ const unsub3 = CometChatCalls.addEventListener("onParticipantLeft", (p) => { /* ... */ });
|
|
82
|
+
+ // Errors now come back via Promise rejection from joinSession() etc.
|
|
83
|
+
+
|
|
84
|
+
+ // Cleanup
|
|
85
|
+
+ return () => { unsub1(); unsub2(); unsub3(); };
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
**Event-name mapping (most common):**
|
|
89
|
+
|
|
90
|
+
| v4 | v5 |
|
|
91
|
+
|---|---|
|
|
92
|
+
| `onCallEnded` | `onSessionLeft` |
|
|
93
|
+
| `onCallEndButtonPressed` | `onLeaveSessionButtonClicked` |
|
|
94
|
+
| `onUserJoined(user)` | `onParticipantJoined(participant)` |
|
|
95
|
+
| `onUserLeft(user)` | `onParticipantLeft(participant)` |
|
|
96
|
+
| `onUserListUpdated(list)` | `onParticipantListChanged(list)` |
|
|
97
|
+
| `onUserMuted(info)` | `onParticipantAudioMuted(participant)` |
|
|
98
|
+
| `onRecordingToggled(info)` | `onRecordingStarted` / `onRecordingStopped` |
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## Step 6 — Migrate session control method names
|
|
103
|
+
|
|
104
|
+
```diff
|
|
105
|
+
- CometChatCalls.endSession()
|
|
106
|
+
+ CometChatCalls.leaveSession()
|
|
107
|
+
|
|
108
|
+
- CometChatCalls.muteAudio(true)
|
|
109
|
+
+ CometChatCalls.muteAudio()
|
|
110
|
+
- CometChatCalls.muteAudio(false)
|
|
111
|
+
+ CometChatCalls.unmuteAudio()
|
|
112
|
+
|
|
113
|
+
- CometChatCalls.pauseVideo(true)
|
|
114
|
+
+ CometChatCalls.pauseVideo()
|
|
115
|
+
- CometChatCalls.pauseVideo(false)
|
|
116
|
+
+ CometChatCalls.resumeVideo()
|
|
117
|
+
|
|
118
|
+
- CometChatCalls.setMode(mode)
|
|
119
|
+
+ CometChatCalls.setLayout(layout)
|
|
120
|
+
|
|
121
|
+
- CometChatCalls.startScreenShare()
|
|
122
|
+
+ CometChatCalls.startScreenSharing()
|
|
123
|
+
|
|
124
|
+
- CometChatCalls.enterPIPMode()
|
|
125
|
+
+ CometChatCalls.enablePictureInPictureLayout()
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## Step 7 — `startSession` → `joinSession`
|
|
131
|
+
|
|
132
|
+
```diff
|
|
133
|
+
- CometChatCalls.generateToken(sessionId, authToken).then((token) => {
|
|
134
|
+
- CometChatCalls.startSession(token, callSettings, container);
|
|
135
|
+
- });
|
|
136
|
+
|
|
137
|
+
+ CometChatCalls.generateToken(sessionId).then((token) => {
|
|
138
|
+
+ CometChatCalls.joinSession(token, sessionSettings, container);
|
|
139
|
+
+ });
|
|
140
|
+
+
|
|
141
|
+
+ // Or — pass the sessionId directly (no manual token mint):
|
|
142
|
+
+ CometChatCalls.joinSession(sessionId, sessionSettings, container);
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
## Removed methods (no v5 replacement)
|
|
148
|
+
|
|
149
|
+
- `CometChatCalls.switchToVideoCall()` — start a fresh session with `sessionType: "VIDEO"` instead
|
|
150
|
+
- `CometChatCalls.getCallDetails()` — track session state via events
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## Verification checklist
|
|
155
|
+
|
|
156
|
+
- [ ] `package.json` lists `@cometchat/calls-sdk-javascript@^5`
|
|
157
|
+
- [ ] `await CometChatCalls.login(authToken)` called after `CometChat.login`
|
|
158
|
+
- [ ] `OngoingCallListener` removed; granular `addEventListener` calls in place with cleanup
|
|
159
|
+
- [ ] `startSession` replaced with `joinSession`
|
|
160
|
+
- [ ] `endSession` replaced with `leaveSession`
|
|
161
|
+
- [ ] Inverted booleans audited (show* → hide* with `!`)
|
|
162
|
+
- [ ] No use of removed methods (`switchToVideoCall`, `getCallDetails`)
|
|
163
|
+
- [ ] Existing call flows tested end-to-end (incoming, accept, mute, screen-share, end)
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## Pointers
|
|
168
|
+
|
|
169
|
+
- Canonical migration guide: https://www.cometchat.com/docs/calls/javascript/migration-guide-v5
|
|
170
|
+
- `cometchat-react-calls/SKILL.md` — current architecture (v5)
|
|
171
|
+
- `cometchat-react-calls/references/call-layouts.md` — layout enum migration
|
|
172
|
+
- `cometchat-react-calls/references/recording.md` — recording events migration
|