easy-im.sdk
v1.2.0
Published
easy-im.sdk
Downloads
150
Maintainers
Readme
easy-im 基于socket.io实现的消息推送服务
安装
npm i easy-im.sdk
引用
import { EasySDK } from 'easy-im.sdk'
创建主机
let host = EasySDK.createHost("127.0.0.1:8001");
获取版本号
const version = EasySDK.version;
初始化
let client = host.init(
"appId",
"token",
"refreshToken"
);
添加连接状态监听
client.addConnectStatusListener((status) => {
console.log("ConnectStatus", status.getConnectStatusName(), status);
});
登录
client.login(
{
uid: '用户标识',
data: {
nickName: '昵称',
},
device_flag: "web",
device_level: 1,
},
(data) => {
console.log(data);
}
);