You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+31-9Lines changed: 31 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,19 +4,21 @@ Use this SDK to add instant messaging capabilities to your application. By conne
4
4
5
5
The iOS SDK core is implemented in [OpenIM SDK Core](https://github.com/openimsdk/openim-sdk-core). Using [gomobile](https://github.com/golang/mobile), it can be compiled into an XCFramework for iOS integration. iOS interacts with the [OpenIM SDK Core](https://github.com/openimsdk/openim-sdk-core) through JSON, and the SDK exposes a re-encapsulated API for easy usage. In terms of data storage, iOS utilizes the SQLite layer provided internally by the [OpenIM SDK Core](https://github.com/openimsdk/openim-sdk-core).
6
6
7
-
The android SDK core is implemented in [OpenIM SDK Core](https://github.com/openimsdk/openim-sdk-core). Using [gomobile](https://github.com/golang/mobile), it can be compiled into an AAR file for Android integration. Android interacts with the [OpenIM SDK Core](https://github.com/openimsdk/openim-sdk-core) through JSON, and the SDK exposes a re-encapsulated API for easy usage. In terms of data storage, Android utilizes the SQLite layer provided internally by the [OpenIM SDK Core](https://github.com/openimsdk/openim-sdk-core).
7
+
The Android SDK core is implemented in [OpenIM SDK Core](https://github.com/openimsdk/openim-sdk-core). Using [gomobile](https://github.com/golang/mobile), it can be compiled into an AAR file for Android integration. Android interacts with the [OpenIM SDK Core](https://github.com/openimsdk/openim-sdk-core) through JSON, and the SDK exposes a re-encapsulated API for easy usage. In terms of data storage, Android utilizes the SQLite layer provided internally by the [OpenIM SDK Core](https://github.com/openimsdk/openim-sdk-core).
8
8
9
9
The React Native Client SDK uses the [NativeModule](https://reactnative.dev/docs/native-modules-intro) system to expose instances of Java/Objective-C classes to JavaScript (JS) as JS objects, thereby allowing you to execute arbitrary native code from within JS.
10
10
11
11
## Tips 🔔
12
12
13
-
1.Starting from `v3.8.3-patch.10`, the package name has been changed from `open-im-sdk-rn` to `@openim/rn-client-sdk`.
13
+
1.**Expo support:** Expo custom dev client workflow is supported from `v3.8.3-patch.10.3` and later.
14
14
15
-
2.**operationID Parameter:**This parameter is used for backend log querying. Starting from `v3.8.3-patch.10.2`, the `operationID` parameter is optional for all APIs (the SDK will auto-generate one if not provided). For earlier versions, this parameter is required and must be passed explicitly.
15
+
2.**Event Binding API:** Starting from `v3.8.3-patch.10.2`, you can use `OpenIMSDK.on()` to listen for events with better TypeScript type hints. Earlier versions must use the `OpenIMEmitter` object. Both approaches remain compatible with the latest version.
16
16
17
-
3.**Event Binding API:** Starting from `v3.8.3-patch.10.2`, you can use `OpenIMSDK.on()` to listen for events with better TypeScript type hints. Earlier versions must use the `OpenIMEmitter` object. Both approaches remain compatible with the latest version.
17
+
3.**operationID Parameter:**This parameter is used for backend log querying. Starting from `v3.8.3-patch.10.2`, the `operationID` parameter is optional for all APIs (the SDK will auto-generate one if not provided). For earlier versions, this parameter is required and must be passed explicitly.
18
18
19
-
4. The `v3.5.1` contains ***significant disruptive updates***. If you need to upgrade, please check the incoming data and the returned data.
19
+
4. Starting from `v3.8.3-patch.10`, the package name has been changed from `open-im-sdk-rn` to `@openim/rn-client-sdk`.
20
+
21
+
5. The `v3.5.1` contains ***significant disruptive updates***. If you need to upgrade, please check the incoming data and the returned data.
20
22
21
23
## Documentation 📚
22
24
@@ -26,10 +28,31 @@ For the SDK reference, see [https://docs.openim.io/sdks/quickstart/reactNative](
26
28
27
29
## Installation 💻
28
30
29
-
### Adding Dependencies
31
+
### Install with React Native CLI
30
32
31
33
```sh
32
-
yarn add @openim/rn-client-sdk
34
+
# install the SDK
35
+
npm install @openim/rn-client-sdk
36
+
37
+
# iOS native dependencies
38
+
cd ios && pod install &&cd ..
39
+
```
40
+
41
+
### Install with Expo
42
+
43
+
`v3.8.3-patch.10.3` and later support Expo via the custom development client (prebuild) workflow. This package bridges native modules, so Expo projects must run in a prebuild/custom development client workflow rather than Expo Go.
44
+
45
+
```sh
46
+
# install the SDK
47
+
npm install @openim/rn-client-sdk
48
+
49
+
# generate native projects and run
50
+
npx expo prebuild
51
+
npx expo run:android
52
+
npx expo run:ios
53
+
54
+
# optional: Expo Go–like dev client experience
55
+
npx expo install expo-dev-client
33
56
```
34
57
35
58
## Usage 🚀
@@ -45,7 +68,6 @@ import RNFS from 'react-native-fs';
45
68
RNFS.mkdir(RNFS.DocumentDirectoryPath+'/tmp');
46
69
47
70
OpenIMSDK.initSDK({
48
-
platformID: 2, // 1: ios, 2: android
49
71
apiAddr: 'http://your-server-ip:10002',
50
72
wsAddr: 'ws://your-server-ip:10001',
51
73
dataDir: RNFS.DocumentDirectoryPath+'/tmp',
@@ -158,7 +180,7 @@ OpenIMSDKRN.sendMessage({
158
180
159
181
## Examples 🌟
160
182
161
-
You can find a demo web app that use the SDK in the [openim-reactnative-demo](https://github.com/openimsdk/openim-reactnative-demo) repository.
183
+
You can find a demo React-Native app that use the SDK in the [openim-reactnative-demo](https://github.com/openimsdk/openim-reactnative-demo) repository.
0 commit comments