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
if isMutable {try messageContainer.encode(isMutable, forKey:.isMutable)}
280
280
}
281
+
282
+
/// Check to see if a notification is potentially too large to be sent to a push service.
283
+
///
284
+
/// - Note: _Some_ push services may still accept larger messages, so you can only truly know if a message is _too_ large by attempting to send it and checking for a ``MessageTooLargeError`` error. However, if a message passes this check, it is guaranteed to not fail for this reason, assuming the push service implements the minimum requirements of the spec, which you can assume for all major browsers. For these reasons, unless you are sending the same message to multiple subscribers, it's often faster to just try sending the message rather than checking before sending.
285
+
///
286
+
/// - Throws: ``MessageTooLargeError`` if the message is too large. Throws another error if encoding fails.
/// The internal logger to use when reporting misconfiguration and background activity.
47
56
nonisolatedletbackgroundActivityLogger:Logger
48
57
@@ -366,6 +375,19 @@ public actor WebPushManager: Sendable {
366
375
)
367
376
}
368
377
378
+
/// Check to see if a message is potentially too large to be sent to a push service.
379
+
///
380
+
/// - Note: _Some_ push services may still accept larger messages, so you can only truly know if a message is _too_ large by attempting to send it and checking for a ``MessageTooLargeError`` error. However, if a message passes this check, it is guaranteed to not fail for this reason, assuming the push service implements the minimum requirements of the spec, which you can assume for all major browsers.
381
+
///
382
+
/// - Parameters:
383
+
/// - message: The message to send as raw data.
384
+
/// - Throws: ``MessageTooLargeError`` if the message is too large.
/// The service worker you registered is expected to know how to decode the string you send.
@@ -428,6 +450,19 @@ public actor WebPushManager: Sendable {
428
450
)
429
451
}
430
452
453
+
/// Check to see if a message is potentially too large to be sent to a push service.
454
+
///
455
+
/// - Note: _Some_ push services may still accept larger messages, so you can only truly know if a message is _too_ large by attempting to send it and checking for a ``MessageTooLargeError`` error. However, if a message passes this check, it is guaranteed to not fail for this reason, assuming the push service implements the minimum requirements of the spec, which you can assume for all major browsers. For these reasons, unless you are sending the same message to multiple subscribers, it's often faster to just try sending the message rather than checking before sending.
456
+
///
457
+
/// - Parameters:
458
+
/// - message: The message to send as a string.
459
+
/// - Throws: ``MessageTooLargeError`` if the message is too large.
/// 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``.
@@ -490,6 +525,18 @@ public actor WebPushManager: Sendable {
490
525
)
491
526
}
492
527
528
+
/// Check to see if a message is potentially too large to be sent to a push service.
529
+
///
530
+
/// - Note: _Some_ push services may still accept larger messages, so you can only truly know if a message is _too_ large by attempting to send it and checking for a ``MessageTooLargeError`` error. However, if a message passes this check, it is guaranteed to not fail for this reason, assuming the push service implements the minimum requirements of the spec, which you can assume for all major browsers. For these reasons, unless you are sending the same message to multiple subscribers, it's often faster to just try sending the message rather than checking before sending.
531
+
///
532
+
/// - Parameters:
533
+
/// - message: The message to send as JSON.
534
+
/// - Throws: ``MessageTooLargeError`` if the message is too large. Throws another error if encoding fails.
/// If you provide ``PushMessage/Notification/data``, the service worker you registered is expected to know how to decode it. Note that dates are encoded using ``/Foundation/JSONEncoder/DateEncodingStrategy/millisecondsSince1970``, and data is encoded using ``/Foundation/JSONEncoder/DataEncodingStrategy/base64``.
@@ -549,6 +596,18 @@ public actor WebPushManager: Sendable {
549
596
)
550
597
}
551
598
599
+
/// Check to see if a message is potentially too large to be sent to a push service.
600
+
///
601
+
/// - Note: _Some_ push services may still accept larger messages, so you can only truly know if a message is _too_ large by attempting to send it and checking for a ``MessageTooLargeError`` error. However, if a message passes this check, it is guaranteed to not fail for this reason, assuming the push service implements the minimum requirements of the spec, which you can assume for all major browsers. For these reasons, unless you are sending the same message to multiple subscribers, it's often faster to just try sending the message rather than checking before sending.
602
+
///
603
+
/// - Parameters:
604
+
/// - notification: The ``PushMessage/Notification`` push notification.
605
+
/// - Throws: ``MessageTooLargeError`` if the message is too large. Throws another error if encoding fails.
/// Check to see if a message is potentially too large to be sent to a push service.
1173
+
///
1174
+
/// - Note: _Some_ push services may still accept larger messages, so you can only truly know if a message is _too_ large by attempting to send it and checking for a ``MessageTooLargeError`` error. However, if a message passes this check, it is guaranteed to not fail for this reason, assuming the push service implements the minimum requirements of the spec, which you can assume for all major browsers. For these reasons, unless you are sending the same message to multiple subscribers, it's often faster to just try sending the message rather than checking before sending.
1175
+
///
1176
+
/// - Throws: ``MessageTooLargeError`` if the message is too large. Throws another error if encoding fails.
0 commit comments