Open jonas0616 opened 7 years ago
Hello, we see exactly the same kind of problem. Did you find a solution about that ?
The problem is on this function :
protected function _updateQueue($aErrorMessage = null)
{
$aStreamErrorMessage = $this->_readErrorMessage();
if (!isset($aErrorMessage) && !isset($aStreamErrorMessage)) {
return false;
} else if (isset($aErrorMessage, $aStreamErrorMessage)) {
if ($aStreamErrorMessage['identifier'] <= $aErrorMessage['identifier']) {
$aErrorMessage = $aStreamErrorMessage;
unset($aStreamErrorMessage);
}
} else if (!isset($aErrorMessage) && isset($aStreamErrorMessage)) {
$aErrorMessage = $aStreamErrorMessage;
unset($aStreamErrorMessage);
}
$this->_log('ERROR: Unable to send message ID ' .
$aErrorMessage['identifier'] . ': ' .
$aErrorMessage['statusMessage'] . ' (' . $aErrorMessage['statusCode'] . ').');
$this->disconnect();
foreach($this->_aMessageQueue as $k => &$aMessage) {
if ($k < $aErrorMessage['identifier']) {
unset($this->_aMessageQueue[$k]);
} else if ($k == $aErrorMessage['identifier']) {
$aMessage['ERRORS'][] = $aErrorMessage;
} else {
break;
}
}
$this->connect();
return true;
}
I think that this is done this way because the code was shared between the two version of the library, the one working with socket and the one working with http2. With the HTTP2 version, we have doubt on the fact that doing disconnection and reconnection is necessary.
According to APNS document: "Normal request failures do not result in termination of a connection". Is it overreacting that it disconnects when any request fails?