Skip to content
This repository has been archived by the owner on Jun 19, 2024. It is now read-only.

Wrep/Notificato/Apns/Gateway.php READ_TIMEOUT #63

Open
jrots opened this issue Oct 17, 2018 · 2 comments
Open

Wrep/Notificato/Apns/Gateway.php READ_TIMEOUT #63

jrots opened this issue Oct 17, 2018 · 2 comments

Comments

@jrots
Copy link

jrots commented Oct 17, 2018

Hi is there a reason why the variable READ_TIMEOUT in SslSocket is not configurable?
What we're seeing now is a timeout of 1 second on each push notification request to apple..
because the reply is always empty...

Push notifications are most of the time fire & forget imho, the reply doesn't matter ...

Will fork this library and put the variable to 0 but would be nice if this configurable and that I can continue to use this library.

Thanks!

@mac-cain13
Copy link
Owner

Not sure if I agree that push notifications are fire and forget. There are 2 reasons why it's important to read what Apple is responding;

  1. Apple can return an error about the push notification (incorrect payload, payload too long, certificate invalid, etc) think you want to know about that so you know that users are not receiving the notifications
  2. Even if the notification is not important and you don't care if it isn't delivered we still need to read for errors because Apple will close the socket when an error occurs. So all following notifications on the same connection will not be received by Apple, even though they are valid

Correctly reading SSL errors in combination with the way PHP is handling sockets was in fact the hardest part of getting this library right. So I think READ_TIMEOUT shouldn't be exposed as an option and it's also not the best idea to change this in a fork.

@nnrudakov
Copy link

@mac-cain13, so if I want to send a message to 1M devices then I have to wait (READ_TIMEOUT * 1M devices / 1M microseconds) seconds. 1M seconds I have to wait in worst case. Do you think is it OK? How many messages in second your lib can send? Do you test it?

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

No branches or pull requests

3 participants