Enum Class DeliveryMode

java.lang.Object
java.lang.Enum<DeliveryMode>
com.iizix.push.DeliveryMode
All Implemented Interfaces:
Serializable, Comparable<DeliveryMode>, Constable

public enum DeliveryMode extends Enum<DeliveryMode>
Which delivery tiers a send is permitted to use.

A notification can reach a recipient by three tiers, best to worst by connection state: in-session (a write down the recipient's live WebSocket — instant, consumes no push throughput, and always residency-legal because the session was already pinned to a compliant server), device push (VAPID or FCM to the device endpoint), and spool (held for later replay). This enum controls whether the fast in-session tier may be used for a given send.

Persistence note. This value is stored in a property container by ordinal() (see the enum-storage idiom in IPushSettings). The order of these constants is therefore part of the persisted and wire contract: new constants MUST be appended at the end, never inserted or reordered, or an existing stored value will silently change meaning.

Author:
IIZI
  • Enum Constant Details

    • PREFER_IN_SESSION

      public static final DeliveryMode PREFER_IN_SESSION
      Prefer the fastest available tier: if the recipient has a live session, deliver in-session; otherwise push to the device; otherwise spool. The mode that most relieves push throughput pressure since live recipients never touch a push endpoint - and NOT the default (ruled 2026-09-24, RR-14b B): under it a user with a page open gets the notification in that page only and nothing on their phone.
    • REQUIRE_DEVICE

      public static final DeliveryMode REQUIRE_DEVICE
      Always push to the device endpoint, even when the recipient has a live session. Required for security-sensitive sends where the device is the trusted factor: delivering a second-factor code into a session that may be live on a different device would break the second-factor property.
    • BOTH

      public static final DeliveryMode BOTH
      Deliver both in-session and to the device: a live session gets it at once AND every subscribed device gets it, as every send did before the in-session tier existed. The default since P4-10 (ruled 2026-09-24, RR-14b B, PUSH-PROPS-DESIGN section 9.2). On the Browser the user has open the two arrive as ONE notification: both are shown on the same Service Worker registration under the same tag, the server's message ID (design 9.1), and the same tag replaces rather than stacks.
  • Field Details

    • DEFAULT

      public static final DeliveryMode DEFAULT
      The default delivery mode: BOTH, since P4-10 (ruled 2026-09-24, RR-14b B). It was PREFER_IN_SESSION while the in-session tier was dormant, when every send reached devices whatever this said; the commit that made the tier available made this the default, so that a user with an open session still gets the notification on their phone. IPushSettings.getDefaultDeliveryMode() reads it at run time - never compare against this constant in a test, compare against the literal.
  • Method Details

    • values

      public static DeliveryMode[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static DeliveryMode valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null