keyStatus(for:)
Check the status of a key against the current configuration.
nonisolated func keyStatus(for keyID: VAPID.Key.ID) -> VAPID.Configuration.KeyStatus
Check the status of a key against the current configuration.
nonisolated func keyStatus(for keyID: VAPID.Key.ID) -> VAPID.Configuration.KeyStatus
s7WebPush0aB7ManagerC9keyStatus3forAA5VAPIDO13ConfigurationV03KeyE0OAG0I0V2IDV_tF
What are these?8P5J8
import WebPush
actor WebPushManager
A manager for sending push messages to subscribers.
enum VAPID
A set of types for Voluntary Application Server Identification, also known as VAPID.
struct Key
Represents the application server’s identification key that is used to confirm to a push service that the server connecting to it is the same one that was subscribed to.
struct ID
The identifier for a private Key
’s public key.
struct Configuration
A configuration object specifying the contact information along with the keys that your application server identifies itself with.
enum KeyStatus
The satus of a key as it relates to a configuration.
convenience init(vapidConfiguration: VAPID.Configuration, networkConfiguration: NetworkConfiguration = .default, backgroundActivityLogger: Logger? = .defaultWebPushPrintLogger, eventLoopGroupProvider: NIOEventLoopGroupProvider = .shared(.singletonMultiThreadedEventLoopGroup))
Initialize a manager with a VAPID configuration.
init(vapidConfiguration: VAPID.Configuration, networkConfiguration: NetworkConfiguration = .default, backgroundActivityLogger: Logger, executor: Executor, skipClientShutdown: Bool = false)
Internal method to install a different executor for mocking.
convenience init(vapidConfiguration: VAPID.Configuration, networkConfiguration: NetworkConfiguration = .default, backgroundActivityLogger: Logger? = .defaultWebPushPrintLogger, unsafeHTTPClient: HTTPClient)
Initialize a manager with an unsafe HTTP Client.
static let maximumEncryptedPayloadSize: Int
The maximum encrypted payload size guaranteed by the spec.
static let maximumMessageSize: Int
The maximum message size allowed.
static let messageEncoder: JSONEncoder
The encoder used when serializing JSON messages.
nonisolated let networkConfiguration: NetworkConfiguration
The network configuration used when configuring the manager.
nonisolated var nextVAPIDKeyID: VAPID.Key.ID { get }
Request a VAPID key to supply to the client when requesting a new subscription.
nonisolated let vapidConfiguration: VAPID.Configuration
The VAPID configuration used when configuring the manager.
nonisolated func checkMessageSize(data message: some DataProtocol) throws(MessageTooLargeError)
Check to see if a message is potentially too large to be sent to a push service.
nonisolated func checkMessageSize(json message: some Encodable & Sendable) throws
Check to see if a message is potentially too large to be sent to a push service.
nonisolated func checkMessageSize<Contents>(notification: PushMessage.Notification<Contents>) throws where Contents : Encodable, Contents : Sendable
Check to see if a message is potentially too large to be sent to a push service.
nonisolated func checkMessageSize(string message: some StringProtocol) throws(MessageTooLargeError)
Check to see if a message is potentially too large to be sent to a push service.
func run() async throws
func send(data message: some DataProtocol, to subscriber: some SubscriberProtocol, deduplicationTopic topic: Topic? = nil, expiration: Expiration = .recommendedMaximum, urgency: Urgency = .high, logger: Logger? = nil) async throws
Send a push message as raw data.
func send(data message: some DataProtocol, to subscriber: some SubscriberProtocol, encodableDeduplicationTopic: some Encodable, expiration: Expiration = .recommendedMaximum, urgency: Urgency = .high, logger: Logger? = nil) async throws
Send a push message as raw data.
func send(json message: some Encodable & Sendable, to subscriber: some SubscriberProtocol, deduplicationTopic topic: Topic? = nil, expiration: Expiration = .recommendedMaximum, urgency: Urgency = .high, logger: Logger? = nil) async throws
Send a push message as encoded JSON.
func send(json message: some Encodable & Sendable, to subscriber: some SubscriberProtocol, encodableDeduplicationTopic: some Encodable, expiration: Expiration = .recommendedMaximum, urgency: Urgency = .high, logger: Logger? = nil) async throws
Send a push message as encoded JSON.
func send<Contents>(notification: PushMessage.Notification<Contents>, to subscriber: some SubscriberProtocol, deduplicationTopic topic: Topic? = nil, expiration: Expiration = .recommendedMaximum, urgency: Urgency = .high, logger: Logger? = nil) async throws where Contents : Encodable, Contents : Sendable
Send a push notification.
func send<Contents>(notification: PushMessage.Notification<Contents>, to subscriber: some SubscriberProtocol, encodableDeduplicationTopic: some Encodable, expiration: Expiration = .recommendedMaximum, urgency: Urgency = .high, logger: Logger? = nil) async throws where Contents : Encodable, Contents : Sendable
Send a push notification.
func send(string message: some StringProtocol, to subscriber: some SubscriberProtocol, deduplicationTopic topic: Topic? = nil, expiration: Expiration = .recommendedMaximum, urgency: Urgency = .high, logger: Logger? = nil) async throws
Send a push message as a string.
func send(string message: some StringProtocol, to subscriber: some SubscriberProtocol, encodableDeduplicationTopic: some Encodable, expiration: Expiration = .recommendedMaximum, urgency: Urgency = .high, logger: Logger? = nil) async throws
Send a push message as a string.
enum Executor
An internal type representing the executor for a push message.
struct Expiration
A duration in seconds used to express when push messages will expire.
struct NetworkConfiguration
The network configuration for a web push manager.
struct Urgency
The urgency with which to deliver a push message.
enum _Message
An internal type representing a push message, accessible when using WebPushTesting
.