Skip to content
forked from zwczou/jpush

极光推送go客户端,支持定时推送,推送,设备标签别名更改等

Notifications You must be signed in to change notification settings

coinexcom/jpush

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

极光推送Golang客户端

注意!!!viawallet专用

用于viawallet 2.5.0版本升级后,将当前设备的当前钱包ID关联的设备给踢下线(如果还有老版本的设备,重新进入后还会再次注册,不影响)。防止升级后,apns/极光2个渠道的推送都推过来

目前支持

  • Push API v3
  • Schedule API v3
  • Device API v3

base url 修改为device,其他的api将404 https://device.jpush.cn

安装

go get github.com/levigross/grequests
go get github.com/zwczou/jpush

使用

  1. 初始化客户端
    client := jpush.NewJpushClient("key", "secret")
  1. 获取推送唯一标识符 cid
    cidList, err = client.PushCid(1, "push")
  1. 推送消息
    payload := &jpush.Payload{
        Platform: jpush.NewPlatform().All(),
        Audience: jpush.NewAudience().All().SetTag("abc", "ef").SetTagAnd("filmtest"),
        Notification: &jpush.Notification{
            Alert: "test",
        },
        Options: &jpush.Options{
             TimeLive:       60,
             ApnsProduction: false,
        },
    }
    msgId, err = client.Push(payload)
    // msgId, err = client.PushValidate(payload)
  1. 创建计划任务
    client.ScheduleCreate

About

极光推送go客户端,支持定时推送,推送,设备标签别名更改等

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 100.0%