const HOST_PROD
pub const HOST_PROD = "api.push.apple.com"Purpose
Constant HOST_PROD, defining protocol or algorithm parameters.
#net/apnsApple Push Notification service provider client (token auth, ES256). priv := ecdsa.parse_private_pem(&p8_pem) or... c := apns.connect(true, &team_id, &key_id, &priv, &bundle_id) or... r := c.push(&device_token, &payload_json) connect opens HTTP/2 to api.push.apple.com (prod) or api.sandbox.push.apple.com. JWT is minted per push (APNs allows cache up to 1h — minting every send is simpler and still cheap vs TLS). v1: one stream per push, no connection pool, no retry, no 410 unregistered bookkeeping. Payload is raw JSON the caller built (aps + custom).
const HOST_PRODpub const HOST_PROD = "api.push.apple.com"Constant HOST_PROD, defining protocol or algorithm parameters.
const HOST_SANDBOXpub const HOST_SANDBOX = "api.sandbox.push.apple.com"Constant HOST_SANDBOX, defining protocol or algorithm parameters.
struct Clientpub struct Client {
}Apns Client session maintaining connection and operations.
This type has no public fields.
struct PushResultpub struct PushResult {
pub status int
pub apns_id string
pub reason string
pub ok bool
}Structure encapsulating status, apns_id, reason, ok.
status intapns_id stringreason stringok boolconnectpub fn connect(production bool, team_id string, key_id string, private_key string, topic string) Clientconnect dials the APNs host and completes the h2 preface. Throws on failure; handle the error or propagate it to the caller.
production boolteam_id stringkey_id stringprivate_key stringtopic stringClient — a value of this type
($&Client) pushpub fn (c $&Client) push(device_token string, payload_json string) PushResultpush sends payload_json to device_token. Reuses cached provider JWT up to 45m.
c $&ClientClient instance used by this call (exclusive borrow).device_token stringpayload_json stringPushResult — a value of this type
($&Client) closepub fn (c $&Client) close()Operation on $&Client: close the resource.
c $&ClientClient instance used by this call (exclusive borrow).This call does not return a value.