@tencent-rtc/mcp 1.3.0 → 1.3.2
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/index.js +4 -0
- package/index.js.map +1 -1
- package/package.json +2 -2
- package/resource/doc/chatuikit/faq/web_sdk/faq.md +125 -0
- package/resource/doc/chatuikit/flutter/faq.md +17 -114
- package/resource/doc/chatuikit/flutter/integrate_tuikit_Flutter.md +86 -722
- package/resource/doc/chatuikit/react/integration.md +430 -49
- package/resource/doc/chatuikit/react/workflow.md +258 -0
- package/resource/doc/chatuikit/vue/integration.md +355 -144
- package/resource/doc/chatuikit/vue/workflow.md +395 -0
- package/resource/doc/roomkit/vue/features/call-user-to-room.md +256 -0
- package/resource/doc/roomkit/vue/features/device-detection.md +388 -0
- package/resource/doc/roomkit/vue/features/device-state.md +480 -0
- package/resource/doc/roomkit/vue/features/free-beauty-panel.md +238 -0
- package/resource/doc/roomkit/vue/features/room-chat.md +427 -0
- package/resource/doc/roomkit/vue/features/room-participant-state.md +407 -0
- package/resource/doc/roomkit/vue/features/room-state.md +291 -0
- package/resource/doc/roomkit/vue/features/room-view.md +338 -0
- package/resource/doc/roomkit/vue/features/schedule-room.md +349 -0
- package/resource/doc/roomkit/vue/features/screen-share.md +333 -0
- package/resource/doc/roomkit/vue/features/virtual-background.md +287 -0
- package/resource/doc/roomkit/vue/features/workflow.md +553 -0
- package/resource/doc/roomkit/vue/integration.md +479 -0
- package/resource/doc/roomkit/vue/workflow.md +487 -0
- package/resource/doc/tuicallkit/react/api.md +21 -0
- package/resource/doc/tuicallkit/vue/api.md +21 -0
- package/tools/chat/get-web-chat-integration.js +31 -14
- package/tools/chat/get-web-chat-integration.js.map +1 -1
- package/tools/definitions/get_web_chat_uikit_integration_def.js +19 -12
- package/tools/definitions/get_web_chat_uikit_integration_def.js.map +1 -1
- package/tools/definitions/get_web_room_feature_detail_def.js +95 -0
- package/tools/definitions/get_web_room_feature_detail_def.js.map +1 -0
- package/tools/definitions/get_web_room_uikit_integration_def.js +44 -0
- package/tools/definitions/get_web_room_uikit_integration_def.js.map +1 -0
- package/tools/index.js +4 -4
- package/tools/index.js.map +1 -1
- package/tools/live/get-web-live-uikit-integration.js +1 -1
- package/tools/room/get-web-room-feature-detail.js +68 -0
- package/tools/room/get-web-room-feature-detail.js.map +1 -0
- package/tools/room/get-web-room-integration.js +43 -0
- package/tools/room/get-web-room-integration.js.map +1 -0
- package/utils/generate-structured-result.js +2 -2
- package/utils/generate-structured-result.js.map +1 -1
- package/utils/report-cls-client.js +1 -1
- package/utils/report-es-client.js +1 -1
- package/resource/doc/chatuikit/flutter/integrate_only_tuichat_Flutter.md +0 -333
- package/resource/doc/chatuikit/flutter/quick_start_Flutter.md +0 -217
- package/resource/doc/chatuikit/react/chat_window_integration.md +0 -94
- package/resource/doc/chatuikit/vue/chat_window_integration.md +0 -156
- package/resource/doc/roomkit/vue/states/device-state.md +0 -369
- package/resource/doc/roomkit/vue/states/login-state.md +0 -59
- package/resource/doc/roomkit/vue/states/room-list-state.md +0 -355
- package/resource/doc/roomkit/vue/states/room-participant-state.md +0 -388
- package/tools/chat/get-web-chat-window-integration.js +0 -28
- package/tools/chat/get-web-chat-window-integration.js.map +0 -1
- package/tools/definitions/get_web_chat_window_integration_def.js +0 -26
- package/tools/definitions/get_web_chat_window_integration_def.js.map +0 -1
- package/tools/room/get-web-room-state-detail.js +0 -31
- package/tools/room/get-web-room-state-detail.js.map +0 -1
|
@@ -1,38 +1,55 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* **React UIKit Version Restriction:** The latest version of `@tencentcloud/chat-uikit-react` 3.0.0 or higher must be used.
|
|
4
|
-
* **Strictly Follow the Documentation Steps and Instructions for Integration:** When integrating components, the steps and instructions in the documentation must be followed precisely.
|
|
5
|
-
* **Strictly Use the Sample Code in the Documentation:** When creating files, the sample code in the documentation must be used to populate the files. The PlaceholderEmpty property of the Chat component does not need to be filled in.
|
|
6
|
-
* **Open Default Conversation:** The `C2Cadministrator` conversation must be opened using `setActiveConversation`.
|
|
7
|
-
* **Retrieve userSig using a tool:** The TUIKit code must be downloaded and integrated according to the documentation before automatically generating a test userID and calling the `get_usersig` tool to retrieve the userSig. The userID does not need to be appended with a timestamp to avoid errors in dynamic calculation.
|
|
8
|
-
* **Account Information Filling:** After obtaining the userSig, the SDKAppID, userID, and userSig will be automatically filled into the code.
|
|
9
|
-
* **Prohibit Creating User Information Configuration Files:** The `config` directory or file for filling in SDKAppID, userID, and userSig must not be automatically created.
|
|
1
|
+
TUIKit is a UI component library based on the Chat SDK. It enables quick implementation of chat, session, search, relationship chain, group, and other features through UI components. This article introduces how to quickly integrate TUIKit and implement core features
|
|
2
|
+
<iframe src="https://web.sdk.qcloud.com/im/demo/docs-example/sample-chat/index.html#/inbox?page=intergration" style="width:100%;height:700px;border:none" allow="camera; microphone; accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="no-referrer-when-downgrade" allowfullscreen></iframe>
|
|
10
3
|
|
|
11
|
-
# chat-uikit-react Integration
|
|
12
4
|
|
|
5
|
+
## Prerequisites
|
|
6
|
+
- Node.js v18 or higher, recommend using the current LTS v22 version
|
|
13
7
|
|
|
14
|
-
|
|
8
|
+
- React v18
|
|
15
9
|
|
|
16
10
|
|
|
17
|
-
|
|
11
|
+
## Create a project
|
|
18
12
|
|
|
13
|
+
Create a new React project named **chat-app** (select **React 18** during project creation and use the TypeScript Template), and complete project initialization as prompted by the scaffold.
|
|
19
14
|
|
|
20
|
-
you can use vite or rsbuild to create a react project.
|
|
21
15
|
|
|
16
|
+
【shell】
|
|
17
|
+
``` bash
|
|
18
|
+
npm create rsbuild@latest
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Installing and Importing Components
|
|
22
|
+
|
|
23
|
+
### Step 1: Dependency Installation
|
|
22
24
|
|
|
23
|
-
|
|
25
|
+
Download [chat-uikit-react](https://www.npmjs.com/package/@tencentcloud/chat-uikit-react) via npm and use it in the project.
|
|
24
26
|
|
|
25
27
|
|
|
26
|
-
|
|
28
|
+
【shell】
|
|
29
|
+
``` bash
|
|
30
|
+
npm i @tencentcloud/chat-uikit-react
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Step 2: Introducing the chat uikit react component
|
|
27
34
|
|
|
35
|
+
> **Note:**
|
|
36
|
+
>
|
|
37
|
+
> - The following code does not include `SDKAppID`, `userID`, and `UserSig`. You need to replace them with the relevant information obtained in [Step 4](https://write.woa.com/document/108053210129276928).
|
|
38
|
+
> - To respect the copyright of emoji designs, the Chat Demo/TUIKit project does not include large emoji graphics. Please replace them with your own designs or other emoji packs for which you hold the copyright before officially launching for commercial use. **The default smiley face emoji pack shown below is copyrighted by Tencent RTC**, you can upgrade to [Chat Pro Plus Edition and Enterprise Edition](https://console.trtc.io/subscription/buy/chat?packType=pro) to use it for free.
|
|
28
39
|
|
|
29
|
-
|
|
40
|
+
> 
|
|
41
|
+
>
|
|
30
42
|
|
|
31
43
|
|
|
32
|
-
|
|
44
|
+
Copy the following `App.tsx` code and replace the original content in `App.tsx`.
|
|
33
45
|
|
|
46
|
+
Copy the following `App.css` code and replace the `App.css` style file in the same directory.
|
|
34
47
|
|
|
35
|
-
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
【App.tsx】
|
|
52
|
+
``` typescript
|
|
36
53
|
import {
|
|
37
54
|
UIKitProvider,
|
|
38
55
|
useLoginState,
|
|
@@ -42,54 +59,418 @@ import {
|
|
|
42
59
|
ChatHeader,
|
|
43
60
|
MessageList,
|
|
44
61
|
MessageInput,
|
|
62
|
+
ContactList,
|
|
63
|
+
ContactInfo,
|
|
64
|
+
useUIKit,
|
|
45
65
|
useConversationListState,
|
|
46
66
|
} from "@tencentcloud/chat-uikit-react";
|
|
67
|
+
import { useEffect, useState } from "react";
|
|
68
|
+
import './App.css';
|
|
47
69
|
|
|
48
|
-
function
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
useEffect(() => {
|
|
52
|
-
// open default conversation
|
|
53
|
-
setActiveConversation('C2Cadministrator');
|
|
54
|
-
}, [setActiveConversation]);
|
|
55
|
-
|
|
70
|
+
function App() {
|
|
71
|
+
// Language support en-US(default) / zh-CN / ja-JP / ko-KR / zh-TW
|
|
72
|
+
// Theme supports light(default) / dark
|
|
56
73
|
return (
|
|
57
|
-
<
|
|
58
|
-
<
|
|
59
|
-
|
|
60
|
-
<ChatHeader />
|
|
61
|
-
<MessageList />
|
|
62
|
-
<MessageInput />
|
|
63
|
-
</Chat>
|
|
64
|
-
</div>
|
|
74
|
+
<UIKitProvider theme={'light'} language={'en-US'}>
|
|
75
|
+
<ChatApp />
|
|
76
|
+
</UIKitProvider>
|
|
65
77
|
);
|
|
66
78
|
}
|
|
67
79
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const userID = ''; // TODO: Replace with your userID
|
|
71
|
-
const SDKAppID = 0; // TODO: Replace with your SDKAppID (Notice: SDKAppID is of type number)
|
|
72
|
-
const userSig = ''; // TODO: Replace with your userSig
|
|
80
|
+
function ChatApp() {
|
|
81
|
+
const [activeTab, setActiveTab] = useState('chats');
|
|
73
82
|
|
|
83
|
+
const { language } = useUIKit();
|
|
84
|
+
|
|
85
|
+
const texts = language === 'zh-CN'
|
|
86
|
+
? { chats: '会话', contacts: '联系人', emptyTitle: '暂无会话', emptySub: '选择一个会话开始聊天', error: '请检查 SDKAppID, userID, userSig, 通过开发人员工具(F12)查看具体的错误信息', loading: '登录中...' }
|
|
87
|
+
: { chats: 'Chats', contacts: 'Contacts', emptyTitle: 'No conversation', emptySub: 'Select a conversation to start chatting', error: 'Please check the SDKAppID, userID, and userSig. View the specific error information through the developer tools (F12).', loading: 'Logging in...'};
|
|
88
|
+
|
|
89
|
+
|
|
74
90
|
const { status } = useLoginState({
|
|
75
|
-
SDKAppID,
|
|
76
|
-
userID,
|
|
77
|
-
userSig,
|
|
91
|
+
SDKAppID: 0, // type: number
|
|
92
|
+
userID: '', // type: string
|
|
93
|
+
userSig: '', // type: string
|
|
78
94
|
})
|
|
95
|
+
const { setActiveConversation } = useConversationListState();
|
|
96
|
+
|
|
97
|
+
useEffect(() => {
|
|
98
|
+
async function init() {
|
|
99
|
+
// You can switch to another created userID
|
|
100
|
+
const userID = 'administrator';
|
|
101
|
+
const conversationID = `C2C${userID}`;
|
|
102
|
+
setActiveConversation(conversationID);
|
|
103
|
+
}
|
|
79
104
|
|
|
105
|
+
if (status === LoginStatus.SUCCESS) {
|
|
106
|
+
init();
|
|
107
|
+
}
|
|
108
|
+
}, [status]);
|
|
109
|
+
|
|
110
|
+
if (status === LoginStatus.ERROR) {
|
|
111
|
+
return (
|
|
112
|
+
<div className="loading-container">
|
|
113
|
+
<div className="loading-spinner"></div>
|
|
114
|
+
<div className="loading-text">{texts.error}</div>
|
|
115
|
+
</div>
|
|
116
|
+
)
|
|
117
|
+
}
|
|
80
118
|
|
|
81
119
|
if (status !== LoginStatus.SUCCESS) {
|
|
82
|
-
return
|
|
120
|
+
return (
|
|
121
|
+
<div className="loading-container">
|
|
122
|
+
<div className="loading-spinner"></div>
|
|
123
|
+
<div className="loading-text">{texts.loading}</div>
|
|
124
|
+
</div>
|
|
125
|
+
)
|
|
83
126
|
}
|
|
84
|
-
|
|
85
|
-
// Language support zh-CN(default) / en-US / ja-JP / ko-KR / zh-TW
|
|
86
|
-
// Theme support light(default) / dark
|
|
127
|
+
|
|
87
128
|
return (
|
|
88
|
-
<
|
|
89
|
-
<
|
|
90
|
-
|
|
129
|
+
<div className="chat-app">
|
|
130
|
+
<ul className="vertical-tabs">
|
|
131
|
+
<li
|
|
132
|
+
className={`tab-item ${activeTab === 'chats' ? 'active' : ''}`}
|
|
133
|
+
onClick={() => {setActiveTab('chats')}}
|
|
134
|
+
>
|
|
135
|
+
{texts.chats}
|
|
136
|
+
</li>
|
|
137
|
+
<li
|
|
138
|
+
className={`tab-item ${activeTab === 'contacts' ? 'active' : ''}`}
|
|
139
|
+
onClick={() => {setActiveTab('contacts')}}
|
|
140
|
+
>
|
|
141
|
+
{texts.contacts}
|
|
142
|
+
</li>
|
|
143
|
+
</ul>
|
|
144
|
+
{
|
|
145
|
+
activeTab === 'chats' && (
|
|
146
|
+
<>
|
|
147
|
+
<ConversationList style={{ flex: '0 0 300px'}}/>
|
|
148
|
+
<Chat
|
|
149
|
+
className="chat-box"
|
|
150
|
+
PlaceholderEmpty={
|
|
151
|
+
<div className="empty-chat">
|
|
152
|
+
<div className="empty-icon">💬</div>
|
|
153
|
+
<div className="empty-title">{texts.emptyTitle}</div>
|
|
154
|
+
<div className="empty-subtitle">{texts.emptySub}</div>
|
|
155
|
+
</div>
|
|
156
|
+
}
|
|
157
|
+
>
|
|
158
|
+
<ChatHeader />
|
|
159
|
+
<MessageList />
|
|
160
|
+
<MessageInput />
|
|
161
|
+
</Chat>
|
|
162
|
+
</>
|
|
163
|
+
)
|
|
164
|
+
}
|
|
165
|
+
{
|
|
166
|
+
activeTab === 'contacts' && (
|
|
167
|
+
<>
|
|
168
|
+
<ContactList style={{ flex: '0 0 300px'}}/>
|
|
169
|
+
<ContactInfo
|
|
170
|
+
style={{ flex: '1'}}
|
|
171
|
+
onSendMessage={() => {setActiveTab('chats')}}
|
|
172
|
+
onEnterGroup={() => {setActiveTab('chats')}}
|
|
173
|
+
/>
|
|
174
|
+
</>
|
|
175
|
+
)
|
|
176
|
+
}
|
|
177
|
+
</div>
|
|
91
178
|
);
|
|
92
179
|
}
|
|
93
180
|
|
|
94
181
|
export default App;
|
|
95
182
|
```
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
【App.css】
|
|
186
|
+
``` css
|
|
187
|
+
body {
|
|
188
|
+
margin: 0;
|
|
189
|
+
padding: 20px;
|
|
190
|
+
font-family: Inter, Avenir, Helvetica, Arial, sans-serif;
|
|
191
|
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
192
|
+
min-height: 100vh;
|
|
193
|
+
box-sizing: border-box;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.chat-app {
|
|
197
|
+
height: calc(100vh - 40px);
|
|
198
|
+
max-width: 1400px;
|
|
199
|
+
margin: 0 auto;
|
|
200
|
+
display: flex;
|
|
201
|
+
flex-direction: row;
|
|
202
|
+
background: #ffffff;
|
|
203
|
+
border-radius: 16px;
|
|
204
|
+
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3),
|
|
205
|
+
0 0 0 1px rgba(0, 0, 0, 0.1);
|
|
206
|
+
overflow: hidden;
|
|
207
|
+
backdrop-filter: blur(10px);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.vertical-tabs {
|
|
211
|
+
list-style: none;
|
|
212
|
+
margin: 0;
|
|
213
|
+
padding: 0;
|
|
214
|
+
width: 100px;
|
|
215
|
+
background: linear-gradient(180deg, #f8f9fa 0%, #e9ecef 100%);
|
|
216
|
+
border-right: 1px solid rgba(0, 0, 0, 0.08);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.tab-item {
|
|
220
|
+
padding: 16px 20px;
|
|
221
|
+
cursor: pointer;
|
|
222
|
+
background: transparent;
|
|
223
|
+
color: #495057;
|
|
224
|
+
font-size: 14px;
|
|
225
|
+
text-align: center;
|
|
226
|
+
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
227
|
+
position: relative;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.tab-item::before {
|
|
231
|
+
content: '';
|
|
232
|
+
position: absolute;
|
|
233
|
+
left: 0;
|
|
234
|
+
top: 50%;
|
|
235
|
+
transform: translateY(-50%);
|
|
236
|
+
width: 3px;
|
|
237
|
+
height: 0;
|
|
238
|
+
background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
|
|
239
|
+
border-radius: 0 3px 3px 0;
|
|
240
|
+
transition: height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
.tab-item:hover {
|
|
244
|
+
background: rgba(102, 126, 234, 0.08);
|
|
245
|
+
color: #667eea;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
.tab-item.active {
|
|
249
|
+
background: linear-gradient(90deg, rgba(102, 126, 234, 0.15) 0%, rgba(102, 126, 234, 0.05) 100%);
|
|
250
|
+
color: #667eea;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
.tab-item.active::before {
|
|
254
|
+
height: 60%;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
.chat-box {
|
|
258
|
+
flex: 1;
|
|
259
|
+
border-left: 1px solid rgba(0, 0, 0, 0.08);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
.empty-chat {
|
|
263
|
+
display: flex;
|
|
264
|
+
flex: 1;
|
|
265
|
+
flex-direction: column;
|
|
266
|
+
align-items: center;
|
|
267
|
+
justify-content: center;
|
|
268
|
+
height: 100%;
|
|
269
|
+
color: #adb5bd;
|
|
270
|
+
gap: 12px;
|
|
271
|
+
text-align: center;
|
|
272
|
+
border-left: 1px solid rgba(0, 0, 0, 0.08);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
.empty-icon {
|
|
276
|
+
font-size: 64px;
|
|
277
|
+
opacity: 0.3;
|
|
278
|
+
animation: float 3s ease-in-out infinite;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
.empty-title {
|
|
282
|
+
font-size: 16px;
|
|
283
|
+
font-weight: 600;
|
|
284
|
+
color: #6c757d;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
.empty-subtitle {
|
|
288
|
+
font-size: 14px;
|
|
289
|
+
color: #868e96;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
@keyframes float {
|
|
293
|
+
0%, 100% {
|
|
294
|
+
transform: translateY(0px);
|
|
295
|
+
}
|
|
296
|
+
50% {
|
|
297
|
+
transform: translateY(-10px);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
.loading-container {
|
|
302
|
+
display: flex;
|
|
303
|
+
flex-direction: column;
|
|
304
|
+
align-items: center;
|
|
305
|
+
justify-content: center;
|
|
306
|
+
height: 100vh;
|
|
307
|
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
308
|
+
gap: 24px;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
.loading-spinner {
|
|
312
|
+
width: 60px;
|
|
313
|
+
height: 60px;
|
|
314
|
+
border: 4px solid rgba(255, 255, 255, 0.2);
|
|
315
|
+
border-top-color: #ffffff;
|
|
316
|
+
border-radius: 50%;
|
|
317
|
+
animation: spin 1s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
|
|
318
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
.loading-text {
|
|
322
|
+
color: #ffffff;
|
|
323
|
+
font-size: 18px;
|
|
324
|
+
font-weight: 500;
|
|
325
|
+
letter-spacing: 0.5px;
|
|
326
|
+
animation: pulse 2s ease-in-out infinite;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
@keyframes spin {
|
|
330
|
+
0% {
|
|
331
|
+
transform: rotate(0deg);
|
|
332
|
+
}
|
|
333
|
+
100% {
|
|
334
|
+
transform: rotate(360deg);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
@keyframes pulse {
|
|
339
|
+
0%, 100% {
|
|
340
|
+
opacity: 1;
|
|
341
|
+
}
|
|
342
|
+
50% {
|
|
343
|
+
opacity: 0.6;
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
### Step 3: Obtain SDKAppID, UserID and UserSig
|
|
349
|
+
|
|
350
|
+
In the previously copied `App.tsx` code, the login authentication information is empty. You need to fill in your Tencent Cloud application authentication information in the `useLoginState hook`, as shown below:
|
|
351
|
+
<table>
|
|
352
|
+
<tr>
|
|
353
|
+
<td rowspan="1" colSpan="1" >Parameter</td>
|
|
354
|
+
|
|
355
|
+
<td rowspan="1" colSpan="1" >Type</td>
|
|
356
|
+
|
|
357
|
+
<td rowspan="1" colSpan="1" >Note</td>
|
|
358
|
+
</tr>
|
|
359
|
+
|
|
360
|
+
<tr>
|
|
361
|
+
<td rowspan="1" colSpan="1" >userID</td>
|
|
362
|
+
|
|
363
|
+
<td rowspan="1" colSpan="1" >String</td>
|
|
364
|
+
|
|
365
|
+
<td rowspan="1" colSpan="1" >Unique identifier of the user, defined by you, it is allowed to contain only upper and lower case letters (a-z, A-Z), numbers (0-9), underscores, and hyphens.</td>
|
|
366
|
+
</tr>
|
|
367
|
+
|
|
368
|
+
<tr>
|
|
369
|
+
<td rowspan="1" colSpan="1" >SDKAppID</td>
|
|
370
|
+
|
|
371
|
+
<td rowspan="1" colSpan="1" >Number</td>
|
|
372
|
+
|
|
373
|
+
<td rowspan="1" colSpan="1" >The unique identifier for the audio and video application created in the [Tencent RTC Console](https://console.trtc.io/).</td>
|
|
374
|
+
</tr>
|
|
375
|
+
|
|
376
|
+
<tr>
|
|
377
|
+
<td rowspan="1" colSpan="1" >SDKSecretKey</td>
|
|
378
|
+
|
|
379
|
+
<td rowspan="1" colSpan="1" >String</td>
|
|
380
|
+
|
|
381
|
+
<td rowspan="1" colSpan="1" >The SDKSecretKey of the audio and video application created in the [Tencent RTC Console](https://console.trtc.io/).</td>
|
|
382
|
+
</tr>
|
|
383
|
+
|
|
384
|
+
<tr>
|
|
385
|
+
<td rowspan="1" colSpan="1" >userSig</td>
|
|
386
|
+
|
|
387
|
+
<td rowspan="1" colSpan="1" >String</td>
|
|
388
|
+
|
|
389
|
+
<td rowspan="1" colSpan="1" >A security protection signature used for user log in authentication to confirm the user's identity and prevent malicious attackers from stealing your cloud service usage rights.</td>
|
|
390
|
+
</tr>
|
|
391
|
+
</table>
|
|
392
|
+
|
|
393
|
+
|
|
394
|
+
> **Explanation of UserSig:**
|
|
395
|
+
>
|
|
396
|
+
|
|
397
|
+
> **Development environment**: If you are running a demo locally and developing or debugging, you can use the `genTestUserSig` (Refer to Step 3.2) function in the debug file to generate a 'userSig'. In this method, SDKSecretKey is vulnerable to decompilation and reverse engineering. Once your key is leaked, attackers can steal your Tencent Cloud traffic.
|
|
398
|
+
>
|
|
399
|
+
|
|
400
|
+
> **Production environment**: If your project is going live, please use the [Server-side Generation of UserSig](https://trtc.io/document/34385) method.
|
|
401
|
+
>
|
|
402
|
+
|
|
403
|
+
1. Log in to [Chat Console](https://console.trtc.io/) .
|
|
404
|
+
|
|
405
|
+
2. Click **Create Application**, enter your application name, then click **Create**.
|
|
406
|
+
|
|
407
|
+
|
|
408
|
+

|
|
409
|
+
|
|
410
|
+
3. After creation, you can view the Application Status, service version, SDKAppID, creation time, Tag, and expiration time of the new application on the console overview page.
|
|
411
|
+
|
|
412
|
+

|
|
413
|
+
|
|
414
|
+
4. [Go to the user management page](https://console.trtc.io/chat/account-management), create 2–3 test accounts for experience in C2C chat and group chat.
|
|
415
|
+
|
|
416
|
+

|
|
417
|
+
|
|
418
|
+
5. UserSig info. Click [IM console > development tool > UserSig tool](https://console.trtc.io/usersig), fill in the created userID, and just generate userSig.
|
|
419
|
+
|
|
420
|
+
|
|
421
|
+
### Step 4: Start the Project
|
|
422
|
+
|
|
423
|
+
Replace SDKAppID, UserID, and UserSig in App.tsx, then run the following command:
|
|
424
|
+
|
|
425
|
+
|
|
426
|
+
【shell】
|
|
427
|
+
``` bash
|
|
428
|
+
npm run dev
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
> **Note:**
|
|
432
|
+
>
|
|
433
|
+
> 1. Please ensure that in Step 3 code, SDKAppID, UserID, and UserSig are all successfully replaced. Failure to replace them will result in abnormal project behavior.
|
|
434
|
+
> 2. A `userID` corresponds to a `userSig`, for more information, see [Generating UserSig](https://trtc.io/document/39074?product=consoleguide).
|
|
435
|
+
> 3. If the project fails to start, please check whether the [development environment requirements](https://write.woa.com/document/108053210129276928) are met.
|
|
436
|
+
|
|
437
|
+
|
|
438
|
+
### Step 6: Send your first message
|
|
439
|
+
|
|
440
|
+
Enter your message in the input box and press Enter to send.
|
|
441
|
+
|
|
442
|
+

|
|
443
|
+
|
|
444
|
+
## FAQs
|
|
445
|
+
|
|
446
|
+
#### What is UserSig?
|
|
447
|
+
|
|
448
|
+
A UserSig is a password for users to log in to Chat. It is essentially the ciphertext generated by encrypting information such as the UserID.
|
|
449
|
+
|
|
450
|
+
#### How can I generate a UserSig?
|
|
451
|
+
|
|
452
|
+
The issuance method for UserSig involves integrating the calculation code of UserSig into your server, and providing an interface oriented towards your project. When UserSig is needed, your project sends a request to the business server to access the dynamic UserSig. For more information, please see [How to Generate a UserSig on the Server](https://trtc.io/document/39074?product=consoleguide).
|
|
453
|
+
|
|
454
|
+
> **Note:**
|
|
455
|
+
>
|
|
456
|
+
|
|
457
|
+
> The exemplary code provided in this document retrieves the UserSig by embedding the SECRETKEY in the client code. This approach makes the SECRETKEY highly susceptible to decompilation and reverse engineering. Once your encryption key is compromised, attackers can misappropriate your Tencent Cloud traffic. Hence, **this procedure is exclusively recommended for running functional debugging locally**. For the correct issuance of UserSig, please refer to the previous sections.
|
|
458
|
+
>
|
|
459
|
+
|
|
460
|
+
|
|
461
|
+
## Communication and Feedback
|
|
462
|
+
|
|
463
|
+
Join the [Telegram Technical Exchange Group](https://t.me/tencent_imsdk) or [WhatsApp Exchange Group](https://chat.whatsapp.com/IVa11ZkVmKTEwSWsAzSyik) to enjoy support from professional engineers and solve your problems.
|
|
464
|
+
|
|
465
|
+
## Documentation
|
|
466
|
+
|
|
467
|
+
#### UIKit Related:
|
|
468
|
+
- [chat-uikit-react npm](https://www.npmjs.com/package/@tencentcloud/chat-uikit-react)
|
|
469
|
+
|
|
470
|
+
- [Demo Source Code and Running Example](https://github.com/TencentCloud/chat-uikit-react)
|
|
471
|
+
|
|
472
|
+
|
|
473
|
+
#### For more features, refer to the ChatEngine API documentation:
|
|
474
|
+
- [chat-uikit-engine API Manual](https://web.sdk.qcloud.com/im/doc/chat-engine-lite/index.html)
|
|
475
|
+
|
|
476
|
+
- [chat-uikit-engine-lite npm](https://www.npmjs.com/package/@tencentcloud/chat-uikit-engine-lite)
|