Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

极光推送

Feature: push-jpush

极光 JPush REST API V3,支持通知/透传/多平台,HTTP Basic Auth。

配置

[push.jpush]
app_key = ""
master_secret = ""
# base_url = "https://api.jpush.cn"
# apns_production = true

API

send(target, notification, options) — 发送通知

#![allow(unused)]
fn main() {
let result = state.push.jpush.send(
    &PushTarget::Cid("registration_id".to_string()),
    &Notification::new("标题", "内容"),
    None,
).await?;
}

send_message(target, content, content_type, extras, options) — 发送透传

#![allow(unused)]
fn main() {
let result = state.push.jpush.send_message(
    &PushTarget::All,
    "{\"action\":\"refresh\"}",
    Some("text"),
    None,
    None,
).await?;
}

send_notification_and_message(target, notification, content, options) — 同时发送

推送目标

PushTargetaudience说明
Cidregistration_id单个注册 ID
CidListregistration_id多个注册 ID
Aliasalias单个别名
AliasListalias多个别名
Tagtag标签(OR)
All"all"广播

参考文档