public class FeedbackServiceConnection extends Object
A connection to the APNs feedback service that listens for expired tokens, then disconnects after a period of inactivity. According to Apple's documentation:
The Apple Push Notification Service includes a feedback service to give you information about failed push notifications. When a push notification cannot be delivered because the intended app does not exist on the device, the feedback service adds that device's token to its list. Push notifications that expire before being delivered are not considered a failed delivery and don't impact the feedback service...
Query the feedback service daily to get the list of device tokens. Use the timestamp to verify that the device tokens haven't been reregistered since the feedback entry was generated. For each device that has not been reregistered, stop sending notifications.
Generally, users of Pushy should not instantiate a FeedbackServiceConnection
directly, but should
instead call PushManager.requestExpiredTokens()
, which will manage the creation and
configuration of a FeedbackServiceConnection
internally.
Constructor and Description |
---|
FeedbackServiceConnection(ApnsEnvironment environment,
SSLContext sslContext,
NioEventLoopGroup eventLoopGroup,
FeedbackConnectionConfiguration configuration,
com.relayrides.pushy.apns.FeedbackServiceListener listener,
String name)
Constructs a new feedback client that connects to the feedback service in the given environment with the
credentials and key/trust managers in the given SSL context.
|
Modifier and Type | Method and Description |
---|---|
void |
connect()
Connects to the APNs feedback service and waits for expired tokens to arrive.
|
void |
shutdownImmediately()
Closes this feedback connection as soon as possible.
|
String |
toString() |
public FeedbackServiceConnection(ApnsEnvironment environment, SSLContext sslContext, NioEventLoopGroup eventLoopGroup, FeedbackConnectionConfiguration configuration, com.relayrides.pushy.apns.FeedbackServiceListener listener, String name)
Constructs a new feedback client that connects to the feedback service in the given environment with the credentials and key/trust managers in the given SSL context.
environment
- the environment in which this feedback client will operatesslContext
- an SSL context with the keys/certificates and trust managers this client should use when
communicating with the APNs feedback serviceeventLoopGroup
- the event loop group this client should use for asynchronous network operationsconfiguration
- the set of configuration options to use for this connection. The configuration object is
copied and changes to the original object will not propagate to the connection after creation. Must not be
null
.name
- a human-readable name for this connection; names must not be null
public void connect()
Connects to the APNs feedback service and waits for expired tokens to arrive. Be warned that this is a destructive operation. According to Apple's documentation:
The feedback service's list is cleared after you read it. Each time you connect to the feedback service, the information it returns lists only the failures that have happened since you last connected.
public void shutdownImmediately()
Copyright © 2013–2015 RelayRides. All rights reserved.