How to use jpush-async - 7 common examples

To help you get started, we’ve selected a few jpush-async examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github airingursb / 2life-server / src / config / index.js View on Github external
.send(function (err, res) {
      if (err) {
        if (err instanceof JPush.APIConnectionError) {
          console.log(err.message)
          // Response Timeout means your request to the server may have already received,
          // please check whether or not to push
          console.log(err.isResponseTimeout)
        } else if (err instanceof JPush.APIRequestError) {
          console.log(err.message)
        }
      } else {
        console.log('Sendno: ' + res.sendno)
        console.log('Msg_id: ' + res.msg_id)
      }
    })
}
github airingursb / 2life-server / src / config / index.js View on Github external
.send(function (err, res) {
      if (err) {
        if (err instanceof JPush.APIConnectionError) {
          console.log(err.message)
          // Response Timeout means your request to the server may have already received,
          // please check whether or not to push
          console.log(err.isResponseTimeout)
        } else if (err instanceof JPush.APIRequestError) {
          console.log(err.message)
        }
      } else {
        console.log('Sendno: ' + res.sendno)
        console.log('Msg_id: ' + res.msg_id)
      }
    })
}
github airingursb / 2life-server / src / config / index.js View on Github external
export const JiGuangPush = (user_id, message) => {
  client.push().setPlatform('ios', 'android')
    .setAudience(JPush.alias(user_id.toString()))
    .setNotification('双生日记', JPush.ios(message), JPush.android(message, null, 1))
    .setMessage(message)
    .setOptions(null, 60, null, is_Production)
    .send(function (err, res) {
      if (err) {
        if (err instanceof JPush.APIConnectionError) {
          console.log(err.message)
          // Response Timeout means your request to the server may have already received,
          // please check whether or not to push
          console.log(err.isResponseTimeout)
        } else if (err instanceof JPush.APIRequestError) {
          console.log(err.message)
        }
      } else {
        console.log('Sendno: ' + res.sendno)
        console.log('Msg_id: ' + res.msg_id)
github airingursb / 2life-server / src / config / index.js View on Github external
export const JiGuangPush = (user_id, message) => {
  client.push().setPlatform('ios', 'android')
    .setAudience(JPush.alias(user_id.toString()))
    .setNotification('双生日记', JPush.ios(message), JPush.android(message, null, 1))
    .setMessage(message)
    .setOptions(null, 60, null, is_Production)
    .send(function (err, res) {
      if (err) {
        if (err instanceof JPush.APIConnectionError) {
          console.log(err.message)
          // Response Timeout means your request to the server may have already received,
          // please check whether or not to push
          console.log(err.isResponseTimeout)
        } else if (err instanceof JPush.APIRequestError) {
          console.log(err.message)
        }
      } else {
        console.log('Sendno: ' + res.sendno)
        console.log('Msg_id: ' + res.msg_id)
      }
github airingursb / 2life-server / src / config / index.js View on Github external
export const WXP_SECRET = '' // 小程序 KEY
export const WX_APP_APPID = '' // 开放平台 APP ID
export const WX_APP_APPSECRET = '' // 开放平台 APPSECRET
export const GITHUB_TOKEN = '' // Github token
export const QCLOUD_APPID = '' // 腾讯云 APPID
export const QCLOUD_SECRETID = '' // 腾讯云 SECRETID
export const QCLOUD_SECRETKEY = '' // 腾讯云 SECRETKEY
export const WEBHOOK_KEY_WECHAT = '' // 企业微信“反馈喵@零熊” WebHook
export const WEBHOOK_KEY_GITHUB = '' // 企业微信“Git喵@零熊” WebHook

export const IS_CHECKING = false

const JPUSH_KEY = ''
const JPUSH_SECRET = ''

const client = JPush.buildClient(JPUSH_KEY, JPUSH_SECRET)

export const JiGuangPush = (user_id, message) => {
  client.push().setPlatform('ios', 'android')
    .setAudience(JPush.alias(user_id.toString()))
    .setNotification('双生日记', JPush.ios(message), JPush.android(message, null, 1))
    .setMessage(message)
    .setOptions(null, 60, null, is_Production)
    .send(function (err, res) {
      if (err) {
        if (err instanceof JPush.APIConnectionError) {
          console.log(err.message)
          // Response Timeout means your request to the server may have already received,
          // please check whether or not to push
          console.log(err.isResponseTimeout)
        } else if (err instanceof JPush.APIRequestError) {
          console.log(err.message)
github zhaotoday / less.js / lib / push / src / index.js View on Github external
module.exports = config => {
  const { APP_KEY, MASTER_SECRET } = config

  JPush.client = JPush.buildClient(APP_KEY, MASTER_SECRET)

  return JPush
}
github zhaotoday / less.js / src / modules / push.js View on Github external
module.exports = app => {
  const { APP_KEY, MASTER_SECRET } = app.$config.PUSH

  JPush.client = JPush.buildClient(APP_KEY, MASTER_SECRET)

  return JPush
}

jpush-async

JPush's officially supported Node.js client library.

GPL-2.0
Latest version published 3 years ago

Package Health Score

42 / 100
Full package analysis