Enum ReconnectionPolicy

    • Enum Constant Detail

      • NEVER

        public static final ReconnectionPolicy NEVER
        Only reconnect if absolutely needed, e.g. when the connection is dropped. This is the recommended mode. Apple recommends using a persistent connection. This improves the latency of sending push notification messages. The down-side is that once the connection is closed ungracefully (e.g. because Apple server drops it), the library wouldn't detect such failure and not warn against the messages sent after the drop before the detection.
      • EVERY_HALF_HOUR

        public static final ReconnectionPolicy EVERY_HALF_HOUR
        Makes a new connection if the current connection has lasted for more than half an hour. This is the sweat-spot in my experiments between dropped connections while minimizing latency.
      • EVERY_NOTIFICATION

        public static final ReconnectionPolicy EVERY_NOTIFICATION
        Makes a new connection for every message being sent. This option ensures that each message is actually delivered to Apple. If you send a lot of messages though, Apple may consider your requests to be a DoS attack.
    • Method Detail

      • values

        public static ReconnectionPolicy[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (ReconnectionPolicy c : ReconnectionPolicy.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static ReconnectionPolicy valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type has no constant with the specified name
        NullPointerException - if the argument is null