This article will introduce how to quickly implement a chat demo. You will complete the following key steps within 10 minutes and ultimately obtain a chat feature with a full user interface. Before you start, you can directly experience the chat below or Try On CodeSandbox. Environment Requirements
npm (use a version that matches the Node version in use)
Running Demo
Step 1: Download the demo source code
git clone https://github.com/TencentCloud/chat-uikit-react
cd chat-uikit-react/examples/sample-chat
npm install
git clone https://github.com/TencentCloud/chat-uikit-react
cd chat-uikit-react/examples/sample-chat
Step 2: Configure the demo
Note:
To respect the copyright of emoji designs, the Chat Demo/TUIKit project does not include cutouts of large emoji elements. 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 and is available for licensed use for a fee. If you need to obtain a license, please contact us. 1. Open the examples/sample-chat
project and find the GenerateTestUserSig.js
file in the path ./examples/sample-chat/src/debug/GenerateTestUserSig.js
.
2. In the GenerateTestUserSig.js
file, set SDKAPPID
and SECRETKEY
. Their values can be obtained in the Chat console. Click the target application tab to enter its configuration page. 3. Copy the key information and save it to the ./examples/sample-chat/src/debug/GenerateTestUserSig.js
file.
Note:
This document mentions a method for generating UserSig by configuring a secret key in the client code. This method makes the secret key susceptible to decompilation and reverse engineering. Once your key is compromised, attackers can misappropriate your Tencent Cloud traffic. Therefore, this method is only suitable for locally running a demo and debugging features.
The correct way to generate UserSig is to integrate the UserSig computation code into your server and provide an API for the app. When UserSig is needed, your app should request a dynamic UserSig from the business server. For more information, see How to Generate a UserSig on the Server. Step 3: Start the project
Step 4: Send your first message
Enter a message in the input box and press Enter to send.
Integrating chat-uikit-react
Contact Us
Was this page helpful?