rs / pushd

Blazing fast multi-protocol mobile and web push notification service
MIT License
1.16k stars 224 forks source link

Testing connections to providers #16

Open HardlyMirage opened 11 years ago

HardlyMirage commented 11 years ago

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?

rs commented 11 years ago

Are you in dev mode ?

HardlyMirage commented 11 years ago

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

rs commented 11 years ago

Yes, I mean using the sandbox URL.

HardlyMirage commented 11 years ago

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?

jvah commented 11 years ago

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:

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 commented 11 years ago

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