@tencentcloud/lite-chat 0.0.1-beta.0 → 1.0.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/README.md ADDED
@@ -0,0 +1,58 @@
1
+ # Official JavaScript SDK for Tencent Cloud Lite Chat
2
+
3
+ ## About Tencent Cloud Lite Chat
4
+
5
+ Tencent Cloud Lite Chat provides globally interconnected chat APIs, multi-platform SDKs. Includes message sending/receiving and user management features by default, fulfilling core IM capabilities, with a bundle size under 200 KB. With its flexible plugin architecture, the SDK enables seamless integration of comprehensive IM features. You can selectively include only the features you need, customize plugin combinations, and maintain optimal bundle size.
6
+
7
+ ## Installation
8
+
9
+ ```javascript
10
+ npm install @tencentcloud/lite-chat --save
11
+ ```
12
+
13
+ ## Getting started
14
+
15
+ ### 1. create an SDK instance
16
+
17
+ ```javascript
18
+ import TencentCloudLiteChat from '@tencentcloud/lite-chat';
19
+
20
+ // Create an SDK instance.
21
+ // The `TencentCloudLiteChat.create()` method returns the same instance for the same `SDKAppID`.
22
+ // The SDK instance is usually represented by `chat`.
23
+ let chat = TencentCloudLiteChat.create({
24
+ SDKAppID: 0 // Replace `0` with the `SDKAppID` of your Chat app during access.
25
+ });
26
+ ```
27
+
28
+ ### 2. Generate UserSig
29
+ UserSig is a password used to log in to Tencent Cloud Lite Chat. It is the ciphertext obtained after data such as UserID is encrypted. This [document](https://trtc.io/document/34385) describes how to generate a UserSig.
30
+
31
+ ### 3. Login in to the Lite Chat SDK
32
+
33
+ ```javascript
34
+ let promise = chat.login({userID: 'your userID', userSig: 'your userSig'});
35
+ promise.then(function(imResponse) {
36
+ console.log(imResponse.data); // Login successful
37
+ if (imResponse.data.repeatLogin === true) {
38
+ // Indicates that the account has logged in and that the current login will be a repeated login.
39
+ console.log(imResponse.data.errorInfo);
40
+ }
41
+ }).catch(function(imError) {
42
+ console.warn('login error:', imError); // Error information
43
+ });
44
+ ```
45
+
46
+
47
+ ## Supported Browsers
48
+
49
+ | Browser | Supported versions |
50
+ | ---- | ---- |
51
+ | Chrome | 16 or higher |
52
+ | Edge | 13 or higher |
53
+ | Firefox | 11 or higher |
54
+ | Safari | 7 or higher |
55
+ | Internet Explorer | 10 or higher |
56
+ | Opera | 12.1 or higher |
57
+ | iOS Safari | 7 or higher |
58
+ | Android Browswer | 4.4 (Kitkat) or higher |