You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 9, 2018. It is now read-only.
Ian Leitch edited this page Aug 28, 2013
·
4 revisions
The Reflection API aims to provide a means to hook into parts of Rapns execution. Possible uses are custom error notifications, performance and throughput monitoring.
If you have used the Rails generator rails g rapns you should see the bollow example in your config/initializers/rapns.rb file.
Rapns.reflectdo |on|
# Called with a Rapns::Apns::Feedback instance when feedback is received# from the APNs that a notification has failed to be delivered.# Further notifications should not be sent to the device.on.apns_feedbackdo |feedback|
end# Called when a notification is queued internally for delivery.# The internal queue for each app runner can be inspected:## Rapns::Daemon::AppRunner.runners.each do |app_id, runner|# runner.app# runner.queue_size# end#on.notification_enqueueddo |notification|
end# Called when a notification is successfully delivered.on.notification_delivereddo |notification|
end# Called when notification delivery failed.# Call 'error_code' and 'error_description' on the notification for the cause.on.notification_faileddo |notification|
end# Called when a notification will be retried at a later date.# Call 'deliver_after' on the notification for the next delivery date# and 'retries' for the number of times this notification has been retried.on.notification_will_retrydo |notification|
end# Called when an APNs connection is lost and will be reconnected.on.apns_connection_lostdo |app,error|
end# Called when the GCM returns a canonical registration ID.# You will need to replace old_id with canonical_id in your records.on.gcm_canonical_iddo |old_id,canonical_id|
end# Called when an APNs certificate will expire within 1 month.# Implement on.error to catch errors raised when the certificate expires.on.apns_certificate_will_expiredo |app,expiration_time|
end# Called when an exception is raised.on.errordo |error|
endend