pushd icon indicating copy to clipboard operation
pushd copied to clipboard

Testing connections to providers

Open HardlyMirage opened this issue 12 years ago • 6 comments

I am trying to send push messages to APNS. I am able to register, subscribe and send events to pushd correctly, but apple doesn't appear to be sending any messages to the devices

How can I debug further?

HardlyMirage avatar Apr 26 '13 13:04 HardlyMirage

Are you in dev mode ?

rs avatar Apr 26 '13 13:04 rs

By dev mode, do you mean using the sandbox url? I don't see any documentation on dev mode.

HardlyMirage avatar Apr 26 '13 20:04 HardlyMirage

Yes, I mean using the sandbox URL.

rs avatar Apr 26 '13 21:04 rs

Yes, I am using it - but how would that help me? I do a strace on the process and see that it has established a connection to the sandbox server, but not sure if it's actually sending the data, or if there's a cert issue. How can I find out?

HardlyMirage avatar Apr 27 '13 05:04 HardlyMirage

We have a logging branch that has a bit more verbose logging at https://github.com/futurice/pushd/tree/logging so you can at least confirm that the messages are going through. You just need to add exports['loglevel'] = 'silly' to your settings.coffee file. But even without it you should see an error message if the messages are not going through to the Apple servers.

Common problems with iOS push notifications:

  • Running on a simulator, push notifications do not work there
  • Accidentally signing the application with the wildcard provisioning profile, you NEED to sign with the app ID
  • Not implementing – application:didReceiveRemoteNotification: in NSApplicationDelegate, notifications silently fail

Cert issue is not very likely in case you have converted it with the instructions provided, but have to be careful not to mix up production certificate and sandbox certificate.

jvah avatar May 07 '13 10:05 jvah

Forgot to add, if you really need detailed debug log from apn, try the following

npm install
cd node_modules/apn/
npm install debug
cd ../..
export DEBUG=apn

And then start pushd normally. This should give you debug log like:

  apn Initialising connection +0ms
  apn Initialising module +1ms
  apn 1 left to send +3ms
  apn Connection established +563ms
  apn Transmitting notification from buffer +0ms
  apn Socket drained +1ms
  apn 0 left to send +0ms
  apn Notification 0 caused an error: 8 +159ms
  apn Raising error: +0ms 8 { encoding: 'utf8',
  payload: { aps: { badge: 1 } },
  expiry: 0,
  identifier: 0,
  device: undefined,
  alert: undefined,
  badge: 1,
  sound: undefined,
  newsstandAvailable: undefined,
  mdm: undefined,
  compiled: true,
  compiledPayload: '{"aps":{"badge":1}}' } { token: <Buffer fe 66 48 9f 30 4d c7 5b 8d 6e 82 00 df f8 a4 56 e8 da ea ce c4 28 b4 27 e9 51 87 41 c9 2c 66 60>,
  subscriberId: 'SsJFmLFCzM0' }
  apn Buffering 0 notifications for resending +1ms
  apn Socket closed +0ms

jvah avatar May 07 '13 10:05 jvah