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

PushManager resends sent Pushes #178

Open
red-led opened this issue Dec 12, 2018 · 3 comments
Open

PushManager resends sent Pushes #178

red-led opened this issue Dec 12, 2018 · 3 comments

Comments

@red-led
Copy link
Contributor

red-led commented Dec 12, 2018

This code will send same message twice:

    ...
    $pushManager = new PushManager(PushManager::ENVIRONMENT_DEV);
    $push = new Push($gcmAdapter, $devices, $message);
    $pushManager->add($push);

    $pushManager->push();
    $pushManager->push();

Is it expected behavior or bug? PushManager can't be reused to send another batch of messages?

@akkaweb
Copy link

akkaweb commented Jan 18, 2019

This is an issue I also encountered where when you try to call $pushManager->push multiple times on one class initialization it will actually repeat a message to the users on the previous push and so on. Because a notification to a user might be different than a notification to another, I find myself initializing the class for every push notification I send. That fixes the multiplication of messages. I just wonder if there is a reset function you can call... I have not seen it thru the code

@seyfer
Copy link
Collaborator

seyfer commented Jan 20, 2019

@akkaweb feel free to add reset() method in PR

@red-led
Copy link
Contributor Author

red-led commented Jan 20, 2019

@seyfer, Consider adding check if $push has been sent somewhere around here:
https://github.com/Ph3nol/NotificationPusher/blob/master/src/Sly/NotificationPusher/PushManager.php#L89-L91

Maybe in next major version, cause it's backward incompatible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants