st3fan / dovecot-xaps-daemon

MIT License
164 stars 37 forks source link

Since update to go xaps-daemon push not working #14

Closed michaaa closed 9 years ago

michaaa commented 9 years ago

The new go-based xapsd doesn't seem to send out pushes for me. The old python-twisted-based version worked (and still works) in my setup as expected.

When a mail receive should be pushed to a client I get the following output by the daemon:

2015/09/07 12:19:28 [DEBUG] Opening database at /var/lib/xapsd/database.json 2015/09/07 12:19:28 [DEBUG] Listening on UNIX socket at /var/run/xapsd/xapsd.sock 2015/09/07 12:19:28 [DEBUG] Parsing /etc/xapsd/certificate.pem to obtain APNS Topic 2015/09/07 12:19:28 [DEBUG] Topic is com.apple.mail.XServer.[deleted] 2015/09/07 12:19:28 [DEBUG] Creating APNS client to gateway.push.apple.com:2195 2015/09/07 12:19:28 Starting xapsd 1.0b1 on /var/run/xapsd/xapsd.sock 2015/09/07 12:20:37 [DEBUG] Accepted a connection 2015/09/07 12:20:37 [DEBUG] Received request: NOTIFY dovecot-username="micha" dovecot-mailbox="INBOX" 2015/09/07 12:20:37 [DEBUG] Returning success:

Log stopped here, maybe there is something missing while trying to send out the push information to APNS? Is there something that I could do wrong when compiling the daemon?

heinemml commented 9 years ago

It looks like your device hasn't registered for push notifications with your server.

If it has registered the log output would be like this:

2015/09/07 13:00:34 [DEBUG] Accepted a connection
2015/09/07 13:00:34 [DEBUG] Received request: NOTIFY dovecot-username="foo@bar.com" dovecot-mailbox="INBOX"
2015/09/07 13:00:34 [DEBUG] Sending notification to XXXXXXXX-YYYY-1234-ABCD-1234567890AB / ABCDEF012345567890ABCDEF1234567098ABCDEF12345677
2015/09/07 13:00:34 [DEBUG] Returning success:

So the "Returning success:" Line is normal (but it also did confuse me in the beginning).

So I guess the problem is, that you exchanged the software including the database but the devices don't know this. I think you could also trigger this by turning off and on the Push mode for this account on your device. If your got multiple users my advice would be to wait some time until the devices register themselfs again (I see this every few hours). It should look something like this:

2015/09/06 23:14:57 [DEBUG] Accepted a connection
2015/09/06 23:14:57 [DEBUG] Received request: REGISTER aps-account-id="XXXXXXXX-XXXX-1234-XXXXXXXXXXX"    aps-device-token="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"      aps-subtopic="com.apple.mobilemail"     dovecot-username="foo@bar.com"     dovecot-mailboxes=("INBOX","Sent Messages")
2015/09/06 23:14:57 [DEBUG] Returning success: com.apple.mail.XServer.4d4a1983-c679-466b-8f28-30a657ddc00c
michaaa commented 9 years ago

You are right. I seems there is no device registered for this account. But the reason is something else. I think I see what the problem is: The database json format is between twistd-version and go-version is not compatible. So rewriting json file or re-register all devices should fix this issue.