Package io.meeds.pwa.model
Interface PwaDirectNotificationBuilder
public interface PwaDirectNotificationBuilder
Contract of a deferred self-contained push scheduled through
PwaNotificationService#scheduleDirectNotification: the notification
content is produced at fire time, once per subscribed device.-
Method Summary
Modifier and TypeMethodDescriptionProduces the notification to push to one device, ornullto cancel the send for that device — the caller's fire-time guard (e.g.default voidonSendFailure(String subscriptionId, PwaNotificationMessage message) Called when the push could not be handed to the device's push service (transport error, or a non-2xx status other than 410 Gone), so the caller can make the content notifiable again for that device.
-
Method Details
-
build
Produces the notification to push to one device, ornullto cancel the send for that device — the caller's fire-time guard (e.g. "already read", "already covered by this device's popup") decides here, not at schedule time. May be called concurrently for different devices. Each call must return a fresh instance: the service mutates the returned message while encoding it (e.g. shrinking the body to the payload cap). Only the body is shrunk, so everything else the builder sets — title, icon, urls, data — is its own responsibility to bound.- Parameters:
subscriptionId- the id of the device subscription being fired- Returns:
- the notification to push, or null to cancel this device's send
-
onSendFailure
Called when the push could not be handed to the device's push service (transport error, or a non-2xx status other than 410 Gone), so the caller can make the content notifiable again for that device. Push stays a best-effort channel: the default does nothing.- Parameters:
subscriptionId- the id of the device subscription that failedmessage- the message returned bybuild(String)
-