From a4e307390a6b837e9bb2a18b23531a047f9a286a Mon Sep 17 00:00:00 2001 From: liangzai-alt Date: Sun, 26 Jan 2025 22:24:41 +0800 Subject: [PATCH 1/4] Update initwebsdk.js --- src/IM/initwebsdk.js | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/src/IM/initwebsdk.js b/src/IM/initwebsdk.js index 34cf1df..2c53352 100644 --- a/src/IM/initwebsdk.js +++ b/src/IM/initwebsdk.js @@ -3,32 +3,25 @@ import EaseChatSDK from 'easemob-websdk'; import { DEFAULT_EASEMOB_APPKEY, DEFAULT_EASEMOB_SOCKET_URL, - DEFAULT_EASEMOB_REST_URL, + DEFAULT_EASEMOB_REST_URL } from './config'; + // 读取自定义配置(因demo需要自定义配置,非必须) const webimConfig = window.localStorage.getItem('webimConfig'); -const CUSTOM_CONFIG = (webimConfig && JSON.parse(webimConfig)) || {}; +const CUSTOM_CONFIG = (webimConfig && JSON.parse(webimConfig)) || { + appKey: '1190250126193957', + imServer: 'im-api-v2.easecdn.com', + restServer: 'im-api-v2.easemob.com' +}; + +console.log('>>>>>>webimConfig', CUSTOM_CONFIG); -//存放实例化后所有的方法 -// let EaseIMClient = {}; -// window.EaseIM = EaseIM = Easemob_SDK; -//实例化环信SDK -/* - * isHttpDNS: isPrivate为true开启私有化配置则走自有配置的url以及apiUrl, - * 否则为true就SDK自助获取DNS地址。 - * 【特别注意】如果不需要私有化配置,也就是自己定义url以及apiUrl。isHttpDNS、url、apiUrl,均可不用填写只用填入appKey!SDK内部会进行自动获取! - **/ +// 实例化环信SDK const EaseChatClient = new EaseChatSDK.connection({ appKey: CUSTOM_CONFIG.appKey ? CUSTOM_CONFIG.appKey : DEFAULT_EASEMOB_APPKEY, - isHttpDNS: !CUSTOM_CONFIG.isPrivate, //取反isPrivate - url: CUSTOM_CONFIG.imServer - ? CUSTOM_CONFIG.imServer - : DEFAULT_EASEMOB_SOCKET_URL, - apiUrl: CUSTOM_CONFIG.restServer - ? `${CUSTOM_CONFIG.restServer}:${CUSTOM_CONFIG.port}` - : DEFAULT_EASEMOB_REST_URL, + isHttpDNS: !CUSTOM_CONFIG.isPrivate, // 取反isPrivate + url: CUSTOM_CONFIG.imServer ? CUSTOM_CONFIG.imServer : DEFAULT_EASEMOB_SOCKET_URL, + apiUrl: CUSTOM_CONFIG.restServer ? `${CUSTOM_CONFIG.restServer}:${CUSTOM_CONFIG.port}` : DEFAULT_EASEMOB_REST_URL }); -//向EaseChatClient下添加构建消息方法。 -EaseChatClient.Message = EaseChatSDK.message; export { EaseChatSDK, EaseChatClient }; From c800d5b9fe518952ea06436c5dcecd9903e721d9 Mon Sep 17 00:00:00 2001 From: liangzai-alt Date: Sun, 26 Jan 2025 22:26:02 +0800 Subject: [PATCH 2/4] Update initwebsdk.js From 0707f5898ba0320220dcb6c9363eb2498386e841 Mon Sep 17 00:00:00 2001 From: liangzai-alt Date: Mon, 27 Jan 2025 00:38:25 +0800 Subject: [PATCH 3/4] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 613ea4f..c8f75a7 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ webim-vue3-demo 是基于环信 sdk 开发的一款具有单聊、群聊等功 ```bash # install dependencies -npm install or yarn install +npm install # serve with hot reload at localhost:9001 npm run dev or yarn run dev From bd53e5a4f2f6fbdad082165912a5c1b13359010b Mon Sep 17 00:00:00 2001 From: liangzai-alt Date: Mon, 27 Jan 2025 00:43:36 +0800 Subject: [PATCH 4/4] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c8f75a7..f6ebefc 100644 --- a/README.md +++ b/README.md @@ -205,7 +205,7 @@ EMClient.open({ username: '', password: '' }); ```javascript import AgoraRTC from 'agora-rtc-sdk-ng'; -const AgoraAppId = 'YOUR AOGRA APPID'; +const AgoraAppId = 'YOUR AOGRA APPID';YXA6ITyaTxGoQ82Hh31A818ygg export { AgoraAppId, AgoraRTC }; ```