0

私はしばらくこれについて頭を悩ませてきました。誰かが助けてくれることを願っていますか? ローカル マシンから実行するとデバイスに問題なくプッシュされる JavaPNS コードがいくつかありますが、そのコードをサーバーにコピーすると、すべて正常に実行され、エラーは発生しませんが、デバイスでアラートが表示されませんか? サーバーからのログをローカルボックスと比較して調べたところ、サーバーでフラッシュメッセージが表示されないことに気付きました。30 スレッドの JavaPNS キューを使用しています。ローカル ボックスとサーバーのどちらの場合でも、送信するアラートは 30 未満です。

public class PushWorker 
{
private PushQueue queue = null;

public PushWorker(File keystore, String password, boolean production) throws KeystoreException
{
    BasicConfigurator.configure();
    int threads = 30;
    this.queue = Push.queue(keystore, password, production, threads);
    queue.start();
}

public void push(String message, String sound, String token, String eventId) throws JSONException
{
    BasicDevice bd = new BasicDevice();
    bd.setToken(token);

    PushNotificationPayload payload = PushNotificationPayload.complex();
    payload.addAlert(message);
    payload.addSound(sound);
    payload.addCustomDictionary("eid", eventId);

    push(payload, bd);
}

private void push(Payload payload, Device device)
{
    queue.add(payload, device);
}
}

----以下は私のローカルボックスからのフラッシュメッセージです --------------

4872 [JavaPNS grouped notification thread in QUEUE mode] DEBUG javapns.notification.PushNotificationManager  - Flushing
4872 [JavaPNS grouped notification thread in QUEUE mode] DEBUG javapns.notification.PushNotificationManager  - At this point, the entire 139-bytes message has been streamed out successfully through the SSL connection
4872 [JavaPNS grouped notification thread in QUEUE mode] DEBUG javapns.notification.PushNotificationManager  - Notification sent on first attempt

どうにかしてキューからフラッシュを強制することはできますか?

----------------------BELOW はサーバーの JavaPNS ロギングです---------------------- -

0 [JavaPNS grouped notification thread in QUEUE mode] DEBUG javapns.communication.ConnectionToAppleServer  - Creating SSLSocketFactory
16 [JavaPNS grouped notification thread in QUEUE mode] DEBUG javapns.communication.ConnectionToAppleServer  - Creating SSLSocketFactory
49 [JavaPNS grouped notification thread in QUEUE mode] DEBUG javapns.communication.ConnectionToAppleServer  - Creating SSLSocket to gateway.sandbox.push.apple.com:2195
49 [JavaPNS grouped notification thread in QUEUE mode] DEBUG javapns.communication.ConnectionToAppleServer  - Creating SSLSocket to gateway.sandbox.push.apple.com:2195
177 [JavaPNS grouped notification thread in QUEUE mode] DEBUG javapns.notification.PushNotificationManager  - Initialized Connection to Host: [gateway.sandbox.push.apple.com] Port: [2195]: 5117f31e[SSL_NULL_WITH_NULL_NULL: Socket[addr=gateway.sandbox.push.apple.com/17.172.233.65,port=2195,localport=56015]]
...
...

DEBUG javapns.notification.Payload  - Adding alert [blah, blah my alert]
14767 [main] DEBUG javapns.notification.Payload  - Adding sound [default]
14767 [main] DEBUG javapns.notification.Payload  - Adding custom Dictionary [eid] = [193790]
14776 [JavaPNS grouped notification thread in QUEUE mode] DEBUG javapns.notification.PushNotificationManager  - Building Raw message from deviceToken and payload
14776 [JavaPNS grouped notification thread in QUEUE mode] DEBUG javapns.notification.PushNotificationManager  - Built raw message ID 16777217 of total length 135
14777 [JavaPNS grouped notification thread in QUEUE mode] DEBUG javapns.notification.PushNotificationManager  - Attempting to send notification: {"aps":{"sound":"default","alert":"blah, blah my alert"},"eid":"193790"}
14777 [JavaPNS grouped notification thread in QUEUE mode] DEBUG javapns.notification.PushNotificationManager  -   to device: [my device number]

それだけです。フラッシュはありません...

4

1 に答える 1

0

サーバーまたはその他のファイアウォール デバイスで iptables を構成していますか?

  • ポート 2195 を許可する必要があるかもしれません。

telnet を使用してテストしてみてください。

$ telnet gateway.sandbox.push.apple.com 2195

SELinux を有効にしていますか? 次の設定を確認します。

$ getsebool -a | grep httpd

httpd_can_network_connect --> ?

オンになっていることを確認してください。

javapns リポジトリ サイトのドキュメントを確認しましたか?

それがどうなるか教えてください。

明細書

于 2012-04-09T02:59:00.547 に答える