0

통장에 통장을 밀어 넣기하고 있습니다. 푸시는 작동하지만 pushnotification에 대해서는 아무 것도 표시되지 않으며 패스 뒷면을 정적으로 업데이트하는 경우 업데이트 된 패스를 얻을 수 있습니다. 이것은 내가 코드를 사용한다 :
통행을 위해 많은 장치로 푸시 함

<?php 


    // Provide the Certificate and Key Data. 
    $cert = '../certificates/Certificates.pem'; 

    $payload = json_encode (array("aps" => "")); 
    error_log('payload :'.$payload,0); 


    // Create the and config the socket context. 
    $streamContext = stream_context_create(); 
    stream_context_set_option($streamContext, 'ssl', 'local_cert', $cert); 
    $password = ''; 

    if (strlen($password)) 
     stream_context_set_option($tContext, 'ssl', 'passphrase', $password); 


    // Open the Connection to the APNS Server. 
    $ConnectAPNS = stream_socket_client('ssl://gateway.push.apple.com:2195', $err, $errstr, 60, STREAM_CLIENT_CONNECT, $streamContext); 

$query1 = mysql_query("select deviceID from registration"); 
$row1 = mysql_fetch_array($query1); 
$deviceID = $row1['deviceID']; 

if(!empty($deviceID)){ 
$query2 = mysql_query("select pushToken from device "); 

while($row2 = mysql_fetch_array($query2)){ 

    $pushToken= $row2['pushToken']; 

    // Compose and pack the push message 
    $apns_message = chr(0) . chr(0) . chr(32) . pack('H*', str_replace(' ', '', $pushToken)) . chr(0) . chr(mb_strlen($payload)) . $payload; 

    $success = fwrite($ConnectAPNS, $apns_message); 

    // Check if we were able to open a socket. 
    if ($success) 
     error_log(date('d-m-Y hh:ii:ss', time()) . ': APNS Message successfully sent to push token ' . $pushToken, 0); 
    else 
     error_log(date('d-m-Y hh:ii:ss', time()) . ': Push error:' . $err . ': ' . $errstr); 

    error_log('Stream Response: ' . print_r($success, true), 0); 
} 
} 
    // Close the Connection to the Server. 
@socket_close($ConnectAPNS); 
fclose ($ConnectAPNS); 
include("feedback.php"); 
?> 
` 


이 코드를 사용하여, 나는 업데이트 패스 pushnotification를 얻을 수 30 MNS하실 수 있습니다! 이 오류는 다음과 같습니다.`May 7 13:33:21 CamMobs-iPod4 passd [21865] : pass.cam-mob.passbookpasstest에 너무 많은 푸시가 너무 많습니다. 심각한 속도 제한이 적용됩니다.


이 오류없이 푸시하는 방법?

답변

1

while 루프를 반복 할 때마다 코드가 새 연결을 엽니 다.

루프 전에 연결을 열고 루프 내의 소켓에 요청을 작성한 다음 스크립트의 끝에서 소켓을 닫으십시오. 그러면 초당 공간에서 몇 가지 요청으로 게이트웨이를 빠르게 망칠 수 있습니다.

+0

나는 이미 시도했지만 3 회 반복하고 작동하지 않습니다! – malinchhan

+0

위의 편집 코드를 보면! – malinchhan

+0

작동하지 않는 기능은 무엇입니까? 같은 오류 메시지가 나타나면 이전 행동 때문에 Apple이 여전히 스로틀 링을하고 있기 때문일 수 있습니다! 잠시 그 상태로 두거나 다른 인증서를 발행하여 시도해보십시오 (새 인증서로 모든 패스를 다시 재발급해야합니다). – PassKit