send(notification:to:deduplicationTopic:expiration:urgency:logger:)

Send a push notification.

WebPushManager.swift:551
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

Parameters

notification

The Notification push notification.

subscriber

The subscriber to send the push message to.

deduplicationTopic

The topic to use when deduplicating messages stored on a Push Service. When specifying a topic, prefer to use send(json:to:encodableDeduplicationTopic:expiration:urgency:logger:) instead.

expiration

The expiration of the push message, after wich delivery will no longer be attempted.

urgency

The urgency of the delivery of the push message.

logger

The logger to use for status updates. If not provided, the background activity logger will be used instead. When running in a server environment, your contextual logger should be used instead giving you full control of logging and metadata.

If you provide data, the service worker you registered is expected to know how to decode it. Note that dates are encoded using millisecondsSince1970, and data is encoded using base64.