champion0125 / apns-php

Automatically exported from code.google.com/p/apns-php
0 stars 0 forks source link

invalid token cause internal error after it. #30

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
As attached log, the first push is sent normal, the second one got a invalid 
token error, ApnsPHP disconnected and connected again. But after that every 
push got a "ERROR: Unable to send message ID 1: Internal error (0 bytes written 
instead of 90 bytes) (999)."

I'm not sure weather it's a bug of apns-php or something wrong with my 
implementing.

My code is just like this:
$this->push->connect();
$this->push->add($data);
$this->push->send();
$this->push->add($data);
$this->push->send();
$this->push->add($data);
$this->push->send();
//...
$this->push->disconnect();

Original issue reported on code.google.com by peng...@gmail.com on 3 Aug 2012 at 6:12

GoogleCodeExporter commented 8 years ago
sorry, log file was missing.
Here it is.

Original comment by peng...@gmail.com on 3 Aug 2012 at 6:17

Attachments:

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
I resolved by the following:
<?php
$this->push->connect();
$this->push->add($data);
$this->push->send();
$errors = $this->push->getErrors(true);
foreach($errors as $error) {
    foreach($error['ERRORS'] as $err) {
        if($err['statusMessage'] == 'Invalid token') exit(); // since i use queue, just exit() and wait for another cosumer to comsume another. Or you may reconnect apns-php here
    }
}

Original comment by peng...@gmail.com on 26 Sep 2012 at 7:54

GoogleCodeExporter commented 8 years ago
Dear,

The project source code has moved to github; if your issue is still valid, 
please open it on github page https://github.com/duccio/ApnsPHP/issues

Thanks.

Original comment by aldo.arm...@gmail.com on 26 Oct 2012 at 11:47