send(data:to:encodableDeduplicationTopic:expiration:urgency:logger:)

Send a push message as raw data.

WebPushManager.swift:357
func send(data message: some DataProtocol, to subscriber: some SubscriberProtocol, encodableDeduplicationTopic: some Encodable, expiration: Expiration = .recommendedMaximum, urgency: Urgency = .high, logger: Logger? = nil) async throws

Parameters

message

The message to send as raw data.

subscriber

The subscriber to send the push message to.

encodableDeduplicationTopic

The topic to use when deduplicating messages stored on a Push Service.

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.

The service worker you registered is expected to know how to decode the data you send.