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

baidu_push

v0.2.0

Published

Node js sdk for baidu push service

Downloads

14

Readme

BaiduPush

Node.js SDK for baidu push service, which is a free, simple, easy scale push service. It support IOS & Android platform. It is a good choice for China app developers.

Install

npm install baidu_push

Example

var BaiduPush = require('baidu_push');
var sender = new BaiduPush({
    apiKey: '',
    secretKey: ''
});

// classic Node.js callback usage
sender.pushSingle({
    channel_id: '3748092266370017686',
    msg_type: 1,
    msg: JSON.stringify({title: 'Hello baidu push notification'})
}, function (err, data) {
    console.log(err, data);
});

// use in promise way
sender.pushSingle({
    channel_id: '3748092266370017686',
    msg_type: 1,
    msg: JSON.stringify({title: 'Hello baidu push notification'})
}).then(function (data) {
    console.log(data);
}).catch(function (err) {
    console.log(err);
});

If you provide a callback function as the second parameter, it will be the classic node.js version. Otherwise it will return a promise.

APIs

This package provide all the methods correspond to Baidu's REST APIs, all method use POST method to invoke Baidu's API.

  • pushSingle --- 推送消息到单台设备
  • pushAll --- 推送广播消息
  • pushTags --- 推送组播消息
  • pushBatchDevice --- 推送消息到给定的一组设备(批量单播)
  • reportQueryMsgStatus --- 查询消息的发送状态
  • reportQueryTimerRecords --- 查询定时消息的发送记录
  • reportQueryTopicRecords --- 查询指定分类主题的发送记录
  • appQueryTags --- 查询标签组列表
  • appCreateTag --- 创建标签组
  • appDelTag --- 删除标签组
  • tagAddDevices --- 添加设备到标签组
  • tagDelDevices --- 将设备从标签组中移除
  • tagDeviceNum --- 查询标签组设备数量
  • timerQueryList --- 查询定时任务列表
  • timerCancel --- 取消定时任务
  • topicQueryList --- 查询分类主题列表
  • reportStatisticDevice --- 当前应用的设备统计信息
  • reportStatisticTopic --- 查询分类主题统计信息

For the detail api info and message structure you can find in Baidu's documentation

Test

$ npm test

TODO

1. support url schema option