From 7b89f8332d8e937376fef48f00396cae48237f54 Mon Sep 17 00:00:00 2001 From: haoxiuwen Date: Wed, 19 Nov 2025 17:27:27 +0800 Subject: [PATCH 1/4] Add IP Addr/Domain Name Config for Private Cloud SDK --- docs/.vuepress/sidebar/document.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/.vuepress/sidebar/document.ts b/docs/.vuepress/sidebar/document.ts index acdfbda15..d9809c536 100644 --- a/docs/.vuepress/sidebar/document.ts +++ b/docs/.vuepress/sidebar/document.ts @@ -179,6 +179,7 @@ const documentSidebar = [ { text: '常见问题', link: 'faq.html', only: ['react-native'] }, { text: '苹果隐私策略', link: 'privacy_policy.html', only: ['ios'] }, { text: '精简版 SDK', link: 'elite_sdk.html', only: ['android', 'ios']}, + { text: '私有云 SDK IP 地址/域名配置', link: 'private_ip_domain.html', only: ['android', 'ios']}, { text: '概述', link: 'overview.html', only: ['applet'] }, { text: '集成介绍', From 69d327664caa8d61655cf15e5df91f872b2116f1 Mon Sep 17 00:00:00 2001 From: haoxiuwen Date: Wed, 19 Nov 2025 17:29:13 +0800 Subject: [PATCH 2/4] Add IP Addr/Domain Config for Private Cloud SDK --- docs/.vuepress/sidebar/document.ts | 2 +- docs/document/android/private_ip_domain.md | 52 ++++++++++++++++++++ docs/document/harmonyos/private_ip_domain.md | 39 +++++++++++++++ docs/document/ios/private_ip_domain.md | 46 +++++++++++++++++ docs/document/web/private_ip_domain.md | 31 ++++++++++++ 5 files changed, 169 insertions(+), 1 deletion(-) create mode 100644 docs/document/android/private_ip_domain.md create mode 100644 docs/document/harmonyos/private_ip_domain.md create mode 100644 docs/document/ios/private_ip_domain.md create mode 100644 docs/document/web/private_ip_domain.md diff --git a/docs/.vuepress/sidebar/document.ts b/docs/.vuepress/sidebar/document.ts index d9809c536..417cb7348 100644 --- a/docs/.vuepress/sidebar/document.ts +++ b/docs/.vuepress/sidebar/document.ts @@ -179,7 +179,7 @@ const documentSidebar = [ { text: '常见问题', link: 'faq.html', only: ['react-native'] }, { text: '苹果隐私策略', link: 'privacy_policy.html', only: ['ios'] }, { text: '精简版 SDK', link: 'elite_sdk.html', only: ['android', 'ios']}, - { text: '私有云 SDK IP 地址/域名配置', link: 'private_ip_domain.html', only: ['android', 'ios']}, + { text: '私有云 SDK IP 地址/域名配置', link: 'private_ip_domain.html', only: ['android', 'ios', 'web', 'harmonyos']}, { text: '概述', link: 'overview.html', only: ['applet'] }, { text: '集成介绍', diff --git a/docs/document/android/private_ip_domain.md b/docs/document/android/private_ip_domain.md new file mode 100644 index 000000000..a8e894c49 --- /dev/null +++ b/docs/document/android/private_ip_domain.md @@ -0,0 +1,52 @@ +# 私有云 SDK IP 地址/域名配置 + + + +## 静态配置 IP 地址/域名 + +SDK 默认指向公有云地址。部署私有云后,需要将地址重新指向新的地址,以下是地址修改方法: + +### 方式一:TCP 连接 + +```java +EMOptions emOptions = new EMOptions();//实例化 EMOptions 对象 +emOptions.setRestServer("10.10.10.10:00");//设置私有云 REST 地址(IP/域名:port) +emOptions.setIMServer("10.10.10.10");//设置私有云 IM 地址 +emOptions.setImPort(00);//设置私有云 IM 端口号 +emOptions.setEnableTLSConnection(true);//设置是否开启加密,TCP 连接为 TLS 加密 + +emOptions.enableDNSConfig(false);//默认是 true,在私有云下,需要关闭(设置成 false) +EMClient.getInstance().init(context,emOptions);//最后初始化 SDK +``` + +### 方式二:WebSocket 连接 + +```java +EMOptions emOptions = new EMOptions();//实例化 EMOptions 对象 +emOptions.setRestServer("https://restaddress");//设置私有云 REST 地址(IP/域名:port) +emOptions.setWebSocketServer("im-api-wechat.easemob.com");//设置 WebSocket 服务器地址 +emOptions.setWebSocketPort(443);//设置 WebSocket 服务器端口号 +emOptions.setEnableTLSConnection(true);//设置是否开启加密,WebSocket为 WSS 协议 + +emOptions.enableDNSConfig(false);//默认是 true,在私有云下,需要关闭(设置成 false) +EMClient.getInstance().init(context,emOptions);//最后初始化 SDK +``` + +:::tip +如果需要配置 HTTPS,只需在 REST 地址前加一个前缀。 +::: + +```java +emOptions.setRestServer("https://10.10.10.10:00");//设置私有云 REST 地址(ip:port) +``` + +## 动态配置地址 + +1. 服务器端配置 DNS 地址表。 +2. 从服务器端动态获取地址。 + +```java +EMOptions emOptions = new EMOptions(); +emOptions.setDnsUrl("url");//从服务器端动态获取地址 +EMClient.getInstance().init(context,emOptions);//初始化 SDK +``` \ No newline at end of file diff --git a/docs/document/harmonyos/private_ip_domain.md b/docs/document/harmonyos/private_ip_domain.md new file mode 100644 index 000000000..c85570f2f --- /dev/null +++ b/docs/document/harmonyos/private_ip_domain.md @@ -0,0 +1,39 @@ +# 私有云 SDK IP 地址/域名配置 + + + +## 静态配置 IP 地址/域名 + +SDK 默认指向公有云地址。部署私有云后,需要将地址重新指向新的地址,以下是地址修改方法: + +```typescript +let options = new ChatOptions({ + appKey: "您的AppKey" +});//实例化 ChatOptions 对象 +options.setRestServer("10.10.10.10:00");//设置私有云 REST 地址(IP/域名:port) +options.setIMServer("10.10.10.10");//设置私有云 IM 地址 +options.setImPort(100);//设置私有云 IM 端口号 + +ChatClient.getInstance().init(options);//最后初始化 SDK +``` + +:::tip +如果需要配置 HTTPS 只需在 REST 地址前加一个前缀。 +::: + +```typescript +options.setRestServer("https://10.10.10.10:00");//设置私有云 REST 地址(IP:port) +``` + +## 动态配置地址 + +1. 服务器端配置 DNS 地址表。 +2. 从服务器端动态获取地址。 + +```typescript +let options = new ChatOptions({ + appKey: "您的AppKey" +}); +options.setDnsURL("url");//从服务器端动态获取地址 +ChatClient.getInstance().init(options);//初始化 SDK +``` \ No newline at end of file diff --git a/docs/document/ios/private_ip_domain.md b/docs/document/ios/private_ip_domain.md new file mode 100644 index 000000000..282841444 --- /dev/null +++ b/docs/document/ios/private_ip_domain.md @@ -0,0 +1,46 @@ +# 私有云 SDK IP 地址/域名配置 + + + +## 静态配置 IP 地址/域名 + +SDK 默认指向公有云地址,在部署私有云后,需要将地址重新指向到新的地址,以下是地址修改方法: + +### 方式一:TCP 连接 + +```objectivec +EMOptions *options = [EMOptions optionsWithAppkey:appkey]; +options.enableDnsConfig = NO; +options.chatPort = 8080;//设置端口号 +options.chatServer = @"xxx.xxx.xxx.xxx";//设置 IP 地址 +options.restServer = @"xxx.xxx.xxx.xxx:8080";//设置ip:port +options.enableTLSConnection = YES;// 是否使用加密连接。TCP 连接为 TLS 加密 +[[EMClient sharedClient] initializeSDKWithOptions:options]; +``` +### 方式二:WebSocket 连接 + +```objectivec +EMOptions* options = [EMOptions optionsWithAppkey:@"Your appkey"]; +options.enableDnsConfig = NO; +options.restServer = @"https://restaddress"; +options.webSocketServer = @"im-api-wechat.easemob.com"; +options.webSocketPort = 443; +options.enableTLSConnection = YES;// 是否使用加密连接。webSocket 为 WSS 协议。 +``` + +:::tip +如果需要配置 HTTPS 只需加一个属性即可。 +::: + +```objectivec +options.usingHttpsOnly = YES; +``` + +## 动态配置地址 + +1. 服务器端配置 DNS 地址表。 +2. 设置服务器端配置的 URL 地址。 + +```objectivec +options.dnsURL = @"xxxx";//设置服务器端配置的 URL 地址 +``` \ No newline at end of file diff --git a/docs/document/web/private_ip_domain.md b/docs/document/web/private_ip_domain.md new file mode 100644 index 000000000..21c0c4853 --- /dev/null +++ b/docs/document/web/private_ip_domain.md @@ -0,0 +1,31 @@ +# 私有云 SDK IP 地址/域名配置 + +## Web Vue 3 Demo + +对于 Web Vue 3 Demo,进行私有化配置需在 [Vue 3 Demo 源代码](https://github.com/easemob/webim-vue-demo/tree/vue3-miniCore) 中进行修改。 + +在 `src/IM/config/index.js` 文件中,修改环境配置: + +```javascript +//环信appKey默认配置项 +export const DEFAULT_EASEMOB_APPKEY = 'easemob#easeim';// 私有化的 App Key +export const DEFAULT_EASEMOB_SOCKET_URL = 'http://im-api-v2.easemob.com/ws';//私有化的 WebSocket 地址 +export const DEFAULT_EASEMOB_REST_URL = 'ws://a1.easemob.com';//私有化的 RESTful 服务器地址 +``` + +## Web React Demo + +对于 Web React Demo,进行私有化配置需在 [React Demo 源代码](https://github.com/easemob/easemob-demo-react/tree/dev_4.0)中进行修改。 + +在 `easemob-demo-react/src/App.tsx` 中修改配置信息,如下所示: + +```javascript + initConfig={{ + appKey: 'easemob#easeim',// 私有化的 App Key + isHttpDNS: false,//固定为 false + restUrl:'http://a1.easemob.com',//私有化的 RESTful 服务器地址 + msyncUrl: 'ws://im-api-v2.easemob.com/ws',//私有化的 WebSocket 地址 + useUserInfo: true, + translationTargetLanguage: state.translationTargetLanguage, + }} +``` From b0f12b0ebd6ff0c47ca4358bd67f76049cdea79c Mon Sep 17 00:00:00 2001 From: haoxiuwen Date: Wed, 19 Nov 2025 18:22:36 +0800 Subject: [PATCH 3/4] modify --- docs/.vuepress/sidebar/document.ts | 1 + docs/document/android/initialization.md | 2 ++ docs/document/harmonyos/initialization.md | 2 ++ docs/document/ios/initialization.md | 2 ++ 4 files changed, 7 insertions(+) diff --git a/docs/.vuepress/sidebar/document.ts b/docs/.vuepress/sidebar/document.ts index 417cb7348..c8ad5bab7 100644 --- a/docs/.vuepress/sidebar/document.ts +++ b/docs/.vuepress/sidebar/document.ts @@ -320,6 +320,7 @@ const documentSidebar = [ ], only: ['applet'] }, + { text: '私有云 SDK IP 地址/域名配置', link: 'private_ip_domain.html', only: ['applet']}, { text: '服务端 API 概述', link: 'overview.html', only: ['server-side'] }, { text: 'API 调用频率限制', link: 'limitationapi.html', only: ['server-side'] }, { diff --git a/docs/document/android/initialization.md b/docs/document/android/initialization.md index 79ba74f71..b6b69c8e0 100644 --- a/docs/document/android/initialization.md +++ b/docs/document/android/initialization.md @@ -22,3 +22,5 @@ options.setAppKey("Your appkey"); ......// 其他 EMOptions 配置。 EMClient.getInstance().init(context, options); ``` + +关于私有云 SDK 的 IP 地址/域名配置,详见 [配置文档](private_ip_domain.html)。 diff --git a/docs/document/harmonyos/initialization.md b/docs/document/harmonyos/initialization.md index 71580a6ee..40118a502 100644 --- a/docs/document/harmonyos/initialization.md +++ b/docs/document/harmonyos/initialization.md @@ -32,3 +32,5 @@ ChatClient.getInstance().init(this.context, { // 其他更多设置 }); ``` + +关于私有云 SDK 的 IP 地址/域名配置,详见 [配置文档](private_ip_domain.html)。 diff --git a/docs/document/ios/initialization.md b/docs/document/ios/initialization.md index 7b74ec921..6db508e69 100644 --- a/docs/document/ios/initialization.md +++ b/docs/document/ios/initialization.md @@ -17,3 +17,5 @@ let options = EMOptions(appkey: "Your appkey") ......// 其他 EMOptions 配置。 EMClient.shared().initializeSDK(with: options) ``` + +关于私有云 SDK 的 IP 地址/域名配置,详见 [配置文档](private_ip_domain.html)。 From ea0222c5e6bba2bf794c7a9427c46be6e5e721bc Mon Sep 17 00:00:00 2001 From: haoxiuwen Date: Wed, 19 Nov 2025 18:23:10 +0800 Subject: [PATCH 4/4] modify --- docs/.vuepress/sidebar/document.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/.vuepress/sidebar/document.ts b/docs/.vuepress/sidebar/document.ts index c8ad5bab7..417cb7348 100644 --- a/docs/.vuepress/sidebar/document.ts +++ b/docs/.vuepress/sidebar/document.ts @@ -320,7 +320,6 @@ const documentSidebar = [ ], only: ['applet'] }, - { text: '私有云 SDK IP 地址/域名配置', link: 'private_ip_domain.html', only: ['applet']}, { text: '服务端 API 概述', link: 'overview.html', only: ['server-side'] }, { text: 'API 调用频率限制', link: 'limitationapi.html', only: ['server-side'] }, {