yuki24 / pushing

Finally, push notification framework that does not hurt. currently supports Android (FCM) and iOS (APNs)
MIT License
46 stars 6 forks source link

Capture client error responses from FCMs with rescue_with Fourseam::FcmDeliveryError #5

Closed yuki24 closed 7 years ago

yuki24 commented 7 years ago

Similar to #4, but for FCM. An example to handle Timeout may look like the following:

class ApplicationNotifier < Fourseam::Base
  rescue_from Fourseam::FcmDeliveryError do |error|
    if error.response&.headers['Retry-After']
      # re-enqueue the job honoring the 'Retry-After' header
    else
      raise # Make sure to raise any other types of error to re-enqueue the job
    end
  end
end