Interface IPushNotification
- All Known Implementing Classes:
PushMessage
A single IPushNotification is what the in-session tier writes down a WebSocket, what the device tier encrypts and pushes to an endpoint, and what the spool tier persists: one object, three delivery mechanisms. It carries only content — a title and an options map aligned to the browser showNotification(title, options) shape that the service worker already consumes — and its own time-to-live. It knows nothing of regions, servers, tiers, or routing; those are the envelope the framework wraps around it. The transport (VAPID vs FCM) is a property of the subscription the notification lands on, not of the notification.
Instances are constructed with IPushNotificationMessageBuilder and are immutable once built.
- Author:
- IIZI
Method Summary
Modifier and TypeMethodDescriptionGets the notification options as an immutable map, aligned to theoptionsargument ofshowNotification— body, icon, badge, tag, data, actions, and the rest.longGets this notification's time-to-live in milliseconds, or a negative value if it carries none and the server default (IPushSettings.getDefaultTTL()) applies.getTitle()Gets the notification title — thetitleargument of the browsershowNotification(title, options)call, and the primary line a device surfaces.
Method Details
getTitle
String getTitle()Gets the notification title — thetitleargument of the browsershowNotification(title, options)call, and the primary line a device surfaces.- Returns:
- The title; never
null.
getOptions
Gets the notification options as an immutable map, aligned to theoptionsargument ofshowNotification— body, icon, badge, tag, data, actions, and the rest. The service worker consumes this shape directly, so the browser leg needs no translation.- Returns:
- An unmodifiable options map; never
null, possibly empty.
getTimeToLiveMillis
long getTimeToLiveMillis()Gets this notification's time-to-live in milliseconds, or a negative value if it carries none and the server default (IPushSettings.getDefaultTTL()) applies.Milliseconds is the unit throughout; conversion to the seconds required by the transport header happens only at the transport boundary. A spooled notification whose TTL has elapsed is dropped rather than replayed.
- Returns:
- The TTL in milliseconds, or a negative value to mean "use the server default".