uniqush / uniqush-push

Uniqush is a free and open source software system which provides a unified push service for server side notification to apps on mobile devices.
http://uniqush.org
Apache License 2.0
1.54k stars 201 forks source link

APNS production problem #126

Closed pacasa2 closed 7 years ago

pacasa2 commented 8 years ago

Hi! I'm using Uniqush-Push to send notifications for my Android/iOS app. In Android devices everything works perfectly, but the problem comes with iOS devices. Devices are subscribed correctly, and i've set the "psp" with the correct data. I'm using a production APNs Certificate to send notification to my published app. The certificate is tested and notifications arrive to my device if I send it directly to apple servers. But i cannot get the notifications sent by Uniqush. This is the error I get:

"failureDetails":[{"requestId":"578ca0c7-kAYj0eA6CzL5pL1q0RNitA==","service":"salama","from":"127.0.0.1:43986","subscriber":"","pushServiceProvider":"apns:eec67a857b8c7dfdf413e03e5d02106d78f228b3","deliveryPoint":"Unknown","code":"UNIQUSH_ERROR_GENERIC","errorMsg":"Failed to send payload to APNS: We are unable to get a connection: read tcp 147.156.222.19:40304-\u003e17.110.225.90:2195: read: connection reset by peer"}],"droppedDetails":[]}

TysonAndre commented 8 years ago

What version of uniqush are you running? There's several possible causes.

Since you're seeing "connection reset by peer", I assume it was able to connect to APNS, but apple closed the connection when an invalid device token was sent.

APNS will close the connection ("connection reset by peer") if a push to the device token is sent to the wrong app.

For example, trying to send a push to a stage device's token through APNS's production server, or trying to send a push to a production device (App store install) through APNS's sandbox server.

Execute curl http://uniqushpushinstall:port/psps to list the push service providers

The "addr" for the service "salama" should be "gateway.push.apple.com:2195" if this PSP was for pushes to app store installs. If the PSP is for a test build, it should be "gateway.sandbox.push.apple.com:2195"

(You need different service names for test device pushes and production device pushes)

Similarly, you should check that "key" and "cert" point to the files for the production/sandbox files, and those files have the expected contents. If they were modified, you need to restart uniqush-push after modification, if not already done.

To set up a sandbox psp, add the flag sandbox=true when calling /addpsp. (The /push command doesn't accept any service configuration flags). See http://uniqush.org/documentation/usage.html

TysonAndre commented 8 years ago

Also, try pushing several times in a row. The error may happen because a previous push to a different device failed.

TysonAndre commented 8 years ago

Also, try running curl http://uniqushpushinstall:port/subscriptions?subscriber=SUBSCRIBERNAME , and verifying that the device token is identical to what is expected

TysonAndre commented 7 years ago

Closing due to inactivity.