Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I catch DownstreamResponse? #5

Closed
Brianop opened this issue May 26, 2017 · 2 comments
Closed

How can I catch DownstreamResponse? #5

Brianop opened this issue May 26, 2017 · 2 comments

Comments

@Brianop
Copy link

Brianop commented May 26, 2017

Hello,
im trying get the downstreamresponse just in case some of the tokens need updating. I can't figure it out on how to get it, is there a way ?

@enniel
Copy link
Owner

enniel commented May 29, 2017

It's must working.

// YourServiceProvider.php
use NotificationChannels\FCM\MessageWasSended;
...
Event::listen(MessageWasSended::class, function (MessageWasSended $event) {
  $downstreamResponse = $event->response;

  $downstreamResponse->numberSuccess();
  $downstreamResponse->numberFailure();
  $downstreamResponse->numberModification();

  //return Array - you must remove all this tokens in your database
  $downstreamResponse->tokensToDelete(); 

  //return Array (key : oldToken, value : new token - you must change the token in your database )
  $downstreamResponse->tokensToModify(); 

  //return Array - you should try to resend the message to the tokens in the array
  $downstreamResponse->tokensToRetry();
});
...

@Brianop
Copy link
Author

Brianop commented May 29, 2017

I finally got it working, thanks for the support!!!

@Brianop Brianop closed this as completed May 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants