notificato icon indicating copy to clipboard operation
notificato copied to clipboard

Wrep/Notificato/Apns/Gateway.php READ_TIMEOUT

Open jrots opened this issue 6 years ago • 2 comments

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!

jrots avatar Oct 17 '18 15:10 jrots

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.

mac-cain13 avatar Oct 18 '18 05:10 mac-cain13

@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?

nnrudakov avatar Sep 26 '19 12:09 nnrudakov