iPhone push bildirim sunucusu: sunucu değişti sonra yapılacak bir şey?

0 Cevap php

Başarıyla geçen yıl bir iPhone push bildirim sunucusu (PHP) uygulamak yönetmek; Ben sunucu değiştirmek zorunda kaldı ve değişiklik bildirimleri artık gönderilmez beri, yanılmışım ... hareketli dosyaları yeterli olduğunu düşünüyordu. Hiçbir hata yok, her şey tamam gibi görünüyor, ama bildirim alınmıyor.

Aşağıda benim sunucu kodu; Herkes bir neden, ya da sorunu bulmak için bir yol düşünmek olabilir? (Notlar: $ deviceTokens var doğru, cihaz belirteçleri içeren, ve ben başarılı bir openssl komutu ile benim pem sertifika test ettik.).

    $payload['aps'] = array('alert' => 'notification!!', 'sound' => 'push.aif');
    $payload = json_encode($payload);

    $streamContext = stream_context_create();
    stream_context_set_option($streamContext, 'ssl', 'local_cert', 'libraries/ck_prod.pem');
    $apns = stream_socket_client('ssl://gateway.sandbox.push.apple.com:' . 2195, $error, $errorString, 2, STREAM_CLIENT_CONNECT, $streamContext);

    if($error) {
        log_message('error', $errorString);
        return;
    }

    log_message('debug', 'sending push notification...');

    if($apns) {
        foreach($deviceTokens as $deviceToken) {
            $apnsMessage = chr(0) . chr(0) . chr(32) . pack('H*', str_replace(' ', '', $deviceToken)) . chr(0) . chr(strlen($payload)) . $payload;
            fwrite($apns, $apnsMessage);
        }
        fclose($apns);
    } else {
        log_message('error', 'error while sending push notification');
    }

0 Cevap