Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 };
```
Expand Down
33 changes: 13 additions & 20 deletions src/IM/initwebsdk.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 };