From 73499d4b40badf820be737d53f6f05877cb54d7c Mon Sep 17 00:00:00 2001 From: Bloomingg <1293499952@qq.com> Date: Mon, 27 May 2024 16:05:39 +0800 Subject: [PATCH] docs: instructions for use electron sdk --- README.md | 113 ++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 80 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index 07c177d..b50b5c1 100644 --- a/README.md +++ b/README.md @@ -1,33 +1,71 @@ -# Node/Electron Client SDK for OpenIM 👨‍đŸ’ģđŸ’Ŧ +# Electron Client SDK for OpenIM 👨‍đŸ’ģđŸ’Ŧ Use this SDK to add instant messaging capabilities to your application. By connecting to a self-hosted [OpenIM](https://www.openim.online/) server, you can quickly integrate instant messaging capabilities into your app with just a few lines of code. -The underlying SDK core is implemented in [OpenIM SDK Core](https://github.com/openimsdk/openim-sdk-core). Using the [WebAssembly](https://webassembly.org/) support provided by Go language, it can be compiled into wasm for web integration. The web 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, JavaScript handles the logic of the SQL layer by virtualizing SQLite and storing it in IndexedDB using [sql.js](https://sql.js.org/). +The underlying SDK core is implemented in [OpenIM SDK Core](https://github.com/openimsdk/openim-sdk-core). Using cgo, it is exported as C interfaces and provided as dynamic libraries such as DLL, SO, and DYLIB for use by other languages, implemented in [OpenIM SDK Cpp](https://github.com/openimsdk/openim-sdk-cpp.git).The web interacts with the [OpenIM SDK Cpp](https://github.com/openimsdk/openim-sdk-cpp.git) through JSON, using FFI (Foreign Function Interface) to communicate with the C interfaces, and the SDK exposes a re-encapsulated API for easy usage. For data storage, it utilizes the SQLite layer that is provided internally by the [OpenIM SDK Core](https://github.com/openimsdk/openim-sdk-core). ## Documentation 📚 -Visit [https://doc.rentsoft.cn/](https://doc.rentsoft.cn/) for detailed documentation and guides. +Visit [https://docs.openim.io/](https://docs.openim.io/) for detailed documentation and guides. -For the SDK reference, see [https://doc.rentsoft.cn/sdks/quickstart/browser](https://doc.rentsoft.cn/sdks/quickstart/browser). +For the SDK reference, see [https://docs.openim.io/sdks/quickstart/electron](https://docs.openim.io/sdks/quickstart/electron). ## Installation đŸ’ģ ### Adding Dependencies ```shell -npm install open-im-sdk-node --save +npm install open-im-sdk-wasm @openim/electron-client-sdk --save ``` +### Obtaining Required Static Resources for WASM + +Follow these steps to obtain the static resources required for WebAssembly (WASM): + +1. Locate the `open-im-sdk-wasm` subdirectory in the `node_modules` directory of your project. Copy all the files in the `assets` folder to your project's public resource directory. + + The files to be copied are: + + - `openIM.wasm` + - `sql-wasm.wasm` + - `wasm_exec.js` + +2. After copying the files, import the `wasm_exec.js` file in your `index.html` file using a `