npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@tencentcloud/donut-push

v8.2.2

Published

Push Service provides a one-stop app push solution, helping you easily enhance user retention and interaction activity.

Downloads

115

Readme

简介

基于腾讯云推送服务(Push),支持 iOS 和 Android 推送,同时适配各大厂商推送。

腾讯云推送服务(Push)提供一站式 App 推送解决方案,助您轻松提升用户留存和互动活跃度,支持与腾讯云即时通信 IM SDK、实时音视频 TRTC SDK、音视频通话 SDK、直播 SDK等音视频终端产品协同集成,在不同场景联合使用,提升业务整体功能体验。

数据可视化,辅助运营策略

支持推送消息全链路问题排查

六地服务部署,严守数据安全

提供了中国、东南亚(新加坡、印尼雅加达)、东北亚(韩国首尔)、欧洲(德国法兰克福)以及北美(美国硅谷)数据存储中心供选择,每个数据中心均支持全球接入。如果您的应用在境外上线且用户主要在境外,您可以根据消息传输需求及合规要求,选择适合您业务的境外数据中心,保障您的数据安全。

快速跑通

步骤1:创建应用

进入 控制台 ,单击创建应用,填写应用名称,选择数据中心,单击确定,完成应用创建。

步骤2:开通推送服务 Push

进入 推送服务 Push,单击立即购买或免费试用 。(每个应用可免费试用一次,有效期7天)

步骤3:创建一个 Donut 项目,进行推送配置

配置方法详见文档

步骤4:项目中集成 @tencentcloud/donut-push

npm install @tencentcloud/donut-push

然后在微信开发者工具中构建 npm。

步骤5:注册推送

复制下面的代码,并将 SDKAppID 和 appKey 替换为您的应用的信息

import Push from '@tencentcloud/donut-push';

const SDKAppID = 0; // 您的 SDKAppID
const appKey = ''; // 客户端密钥
if (Push) {
  Push.registerPush(SDKAppID, appKey)
    .then((res) => {
      console.info("registerPush", JSON.stringify(res));
    })
    .catch((res) => {
      console.error("registerPush", JSON.stringify(res));
    });
}

接口

|API|描述| |---|---| |setRegistrationID|设置注册推送服务使用的推送 ID 标识,即 RegistrationID,需要在注册推送服务之前调用。| |getRegistrationID|注册推送服务成功后,获取推送 ID 标识,即 RegistrationID。| |registerPush|注册推送服务 (必须在 App 用户同意了隐私政策,并且确定为 App 用户开始提供推送服务后,再调用该接口使用推送服务)。| |unRegisterPush|反注册关闭推送服务。| |addPushListener|订阅推送事件,如点击通知栏| |removePushListener|取消订阅推送事件|


1、注册推送服务 (必须在 App 用户同意了隐私政策,并且确定为 App 用户开始提供推送服务后,再调用该接口使用推送服务)

registerPush(sdkAppID: number, appKey: string): Promise<JSON>;

|参数|类型|必填|说明| |---|---|---|---| |sdkAppID|number|是|推送(Push)应用 ID| |appKey|string|是|推送(Push)应用客户端密钥|

|返回值|说明| |---|---| |Promise|成功返回 {"errCode":0,"errMsg":"success","data":{"token":"xxx"}},失败返回 { errCode: number, errMsg: string }|

2、反注册关闭推送服务。

unRegisterPush(): Promise<JSON>;

|返回值|说明| |---|---| |Promise|成功返回 {"errCode":0,"errMsg":"success"},失败返回 { errCode: number, errMsg: string }|

3、设置注册推送服务使用的推送 ID 标识,即 RegistrationID,需要在注册推送服务之前调用

setRegistrationID(registrationID: string): Promise<JSON>;

|参数|类型|必填|说明| |---|---|---|---| |registrationID|string|是|设备的推送标识 ID,卸载重装会改变|

|返回值|说明| |---|---| |Promise|成功返回 {"errCode":0,"errMsg":"success","data":{"token":"xxx"}},失败返回 { errCode: number, errMsg: string }|

4、注册推送服务成功后,获取推送 ID 标识,即 RegistrationID

getRegistrationID(): Promise<JSON>;

|返回值|说明| |---|---| |Promise|成功返回 {"errCode":0,"errMsg":"success","data":{"registrationID":"xxx"}},失败返回 { errCode: number, errMsg: string }|

5、订阅推送事件,如点击通知栏,收到在线推送信息等

addPushListener(eventName: string, listener: (res: any) => void): void;

|参数|类型|必填|说明| |---|---|---|---| |eventName|string|是|推送事件类型,可查看 Push.EventName | |listener| (res: any) => void|是|推送事件处理方法|

6、取消订阅推送事件

removePushListener(eventName: string, listener: (res: any) => void): void;

|参数|类型|必填|说明| |---|---|---|---| |eventName|string|是|推送事件类型,可查看 Push.EventName| |listener| (res: any) => void|是|推送事件处理方法|