You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Sources/WebPush/WebPushManager.swift
+102-3Lines changed: 102 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -250,7 +250,7 @@ public actor WebPushManager: Sendable {
250
250
/// - Parameters:
251
251
/// - message: The message to send as raw data.
252
252
/// - subscriber: The subscriber to send the push message to.
253
-
/// - deduplicationTopic: The topic to use when deduplicating messages stored on a Push Service.
253
+
/// - deduplicationTopic: The topic to use when deduplicating messages stored on a Push Service. When specifying a topic, prefer to use ``send(data:to:encodableDeduplicationTopic:expiration:urgency:logger:)`` instead.
254
254
/// - expiration: The expiration of the push message, after wich delivery will no longer be attempted.
255
255
/// - urgency: The urgency of the delivery of the push message.
256
256
/// - 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.
@@ -281,14 +281,47 @@ public actor WebPushManager: Sendable {
281
281
}
282
282
}
283
283
284
+
/// Send a push message as raw data.
285
+
///
286
+
/// The service worker you registered is expected to know how to decode the data you send.
287
+
///
288
+
/// - Parameters:
289
+
/// - message: The message to send as raw data.
290
+
/// - subscriber: The subscriber to send the push message to.
291
+
/// - encodableDeduplicationTopic: The topic to use when deduplicating messages stored on a Push Service.
292
+
/// - expiration: The expiration of the push message, after wich delivery will no longer be attempted.
293
+
/// - urgency: The urgency of the delivery of the push message.
294
+
/// - 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 string you send.
287
320
///
288
321
/// - Parameters:
289
322
/// - message: The message to send as a string.
290
323
/// - subscriber: The subscriber to send the push message to.
291
-
/// - deduplicationTopic: The topic to use when deduplicating messages stored on a Push Service.
324
+
/// - deduplicationTopic: The topic to use when deduplicating messages stored on a Push Service. When specifying a topic, prefer to use ``send(string:to:encodableDeduplicationTopic:expiration:urgency:logger:)`` instead.
292
325
/// - expiration: The expiration of the push message, after wich delivery will no longer be attempted.
293
326
/// - urgency: The urgency of the delivery of the push message.
294
327
/// - 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.
@@ -310,14 +343,47 @@ public actor WebPushManager: Sendable {
310
343
)
311
344
}
312
345
346
+
/// Send a push message as a string.
347
+
///
348
+
/// The service worker you registered is expected to know how to decode the string you send.
349
+
///
350
+
/// - Parameters:
351
+
/// - message: The message to send as a string.
352
+
/// - subscriber: The subscriber to send the push message to.
353
+
/// - encodableDeduplicationTopic: The topic to use when deduplicating messages stored on a Push Service.
354
+
/// - expiration: The expiration of the push message, after wich delivery will no longer be attempted.
355
+
/// - urgency: The urgency of the delivery of the push message.
356
+
/// - 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 JSON you send. Note that dates are encoded using ``/Foundation/JSONEncoder/DateEncodingStrategy/millisecondsSince1970``, and data is encoded using ``/Foundation/JSONEncoder/DataEncodingStrategy/base64``.
316
382
///
317
383
/// - Parameters:
318
384
/// - message: The message to send as JSON.
319
385
/// - subscriber: The subscriber to send the push message to.
320
-
/// - deduplicationTopic: The topic to use when deduplicating messages stored on a Push Service.
386
+
/// - 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.
321
387
/// - expiration: The expiration of the push message, after wich delivery will no longer be attempted.
322
388
/// - urgency: The urgency of the delivery of the push message.
323
389
/// - 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.
@@ -339,6 +405,39 @@ public actor WebPushManager: Sendable {
339
405
)
340
406
}
341
407
408
+
/// Send a push message as encoded JSON.
409
+
///
410
+
/// The service worker you registered is expected to know how to decode the JSON you send. Note that dates are encoded using ``/Foundation/JSONEncoder/DateEncodingStrategy/millisecondsSince1970``, and data is encoded using ``/Foundation/JSONEncoder/DataEncodingStrategy/base64``.
411
+
///
412
+
/// - Parameters:
413
+
/// - message: The message to send as JSON.
414
+
/// - subscriber: The subscriber to send the push message to.
415
+
/// - encodableDeduplicationTopic: The topic to use when deduplicating messages stored on a Push Service.
416
+
/// - expiration: The expiration of the push message, after wich delivery will no longer be attempted.
417
+
/// - urgency: The urgency of the delivery of the push message.
418
+
/// - 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.
0 commit comments