01
初始化客户端
方法名称:init
使用方法和参数说明,详见 接入指南 Step 2。
方法名称:init
使用方法和参数说明,详见 接入指南 Step 2。
方法名称:connect
使用方法和参数说明,详见 接入指南 Step 3。
方法名称:subscribe
使用方法和参数说明,详见 接入指南 Step 4。
方法名称:unSubscribe
easyPush.unSubscribe({
channel: 'channel0',
onSuccess: function (subscribeChannels) {
// to do something
},
onFailed: function (message) {
// to do something
}
});
| 名称 | 参数值类型 | 说明 |
|---|---|---|
| channel | 字符串 | 退订的通道名称,对应 subscribe 的 channel 参数。 |
| onSuccess | 函数 | 退订成功后调用,返回当前已订阅通道对象,key 为通道名,value 固定为 1。 |
| onFailed | 函数 | 退订失败后调用,返回失败原因字符串。 |
方法名称:publish
使用方法和参数说明,详见 接入指南 Step 5。
方法名称:disconnect
easyPush.disconnect({
onSuccess: function () {
// to do something
}
});
| 名称 | 参数值类型 | 说明 |
|---|---|---|
| onSuccess | 函数 | 断开连接成功后调用。 |
方法名称:onDisconnect
easyPush.onDisconnect(function () {
// to do something
});
| 名称 | 参数值类型 | 说明 |
|---|---|---|
| 无 | 函数 | 连接断开时调用,可用于执行清理操作或提示用户重新连接。 |