start";$br = '
';$client = new JPushClient($app_key, $master_secret);$tname="TestTeacherAqq_com";$day="2016-1-12 11:01:02";$oid="123424";$result = $client->push() ->setPlatform(M\all) ->setAudience(M\audience(M\alias(array($tname)))) ->setNotification(M\notification("Linghaowan.The appointment at".$day." has finished. #".$oid)) ->send();// echo 'Push Success.' . $br;// echo 'sendno : ' . $result->sendno . $br;// echo 'msg_id : ' .$result->msg_id . $br;// echo 'Response JSON : ' . $result->json . $br; ?>
後端只發一次,但手機端會接收到多達4條,瀏覽器上還會報錯
Fatal error: Uncaught exception 'JPush\Exception\APIConnectionException' with message 'Response timeout. Your request has probably be received by JPUsh Server,please check that whether need to be pushed again
回複內容:
start";$br = '
';$client = new JPushClient($app_key, $master_secret);$tname="TestTeacherAqq_com";$day="2016-1-12 11:01:02";$oid="123424";$result = $client->push() ->setPlatform(M\all) ->setAudience(M\audience(M\alias(array($tname)))) ->setNotification(M\notification("Linghaowan.The appointment at".$day." has finished. #".$oid)) ->send();// echo 'Push Success.' . $br;// echo 'sendno : ' . $result->sendno . $br;// echo 'msg_id : ' .$result->msg_id . $br;// echo 'Response JSON : ' . $result->json . $br; ?>
後端只發一次,但手機端會接收到多達4條,瀏覽器上還會報錯
Fatal error: Uncaught exception 'JPush\Exception\APIConnectionException' with message 'Response timeout. Your request has probably be received by JPUsh Server,please check that whether need to be pushed again
是網路延遲問題,可以把 SDK 中的 CONNECT_TIMEOUT 設定的長一些(10秒)就好了。
另外建議升級成最新的 SDK,新版的介面比老的好用很多!