New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Push Messaging not registering #883

Open
RoundOrange opened this Issue Nov 12, 2017 · 21 comments

Comments

Projects
None yet
6 participants
@RoundOrange

RoundOrange commented Nov 12, 2017

Hi

I am unable to get ChatSecure to register for push notifications. I have reviewed other issues, but from what I can tell, most are about push as least trying to register but not working. In my case, the app will not register for push notifications.

My Setup:

What happens:
When I open "Server Information" for the account. I see the loading symbol for "Push Registration" and a green tick for "Push". Very quickly, both symbols change to a yellow warning symbol and the message "Device Not Registered" appears in the "Push Registration" section. Is this message referring to https://push.chatsecure.org/api/v1/ or prosody?

In the prosody logs, I do not see a request to enable push notification from the device. No attempt is made to connect to any chatsecure.org servers. Does the registration process require any open ports on the prosody server other than the usual c2s & s2s ports (if any at all)?

I suspect that the information provided at https://push.chatsecure.org/api/v1/ is about the API and that I don't need to manually create an account there. Is this correct?

On the iPhone, Background App Refresh is enabled and all Notification options are enabled for ChatSecure. Low Power Mode is off. Any other settings I should check? I have tried Logout/Login, restarting the phone, reinstalling the app.

Any assistance will be appreciated. Thanks.

@chrisballinger

This comment has been minimized.

Member

chrisballinger commented Nov 13, 2017

Wow thanks for the very detailed issue, you definitely did your homework. :) Based on everything you've mentioned it should be working and my personal server setup is almost identical.

The basic push flow is this:

  1. iOS client sends the device's APNS push token to https://push.chatsecure.org/api/v1/ (making an account if needed).
  2. If step 1 succeeds... iOS client sends "pubsub.chatsecure.org", random rotating token provided by push.chatsecure.org/api, and the "push.chatsecure.org/api" endpoint itself, to your XMPP server. Our pubsub node does server-to-server communication with your own server.
  3. When you're offline your server will use mod_cloud_notify to lookup "pubsub.chatsecure.org" and send an XMPP packet to that server containing the random token from (2), as well as "push.chatsecure.org/api".
  4. pubsub.chatsecure.org receives API endpoint ("push.chatsecure.org/api") and random token, constructs HTTP POST request, and fires it off.
  5. "push.chatsecure.org/api" receives the POST and extracts random token, then looks up your account, and then looks up your APNS push token. Then it sends a push message to Apple.

It looks like you're having issues with step 1, but possibly step 2 as well. If you don't see any logs from mod_cloud_notify then it's probably failing on step 1. What happens when you try the "Reset..." button on the info screen with the warning?

@RoundOrange

This comment has been minimized.

RoundOrange commented Nov 13, 2017

Based on the push flow, I also suspect the problem is at step 1. The only thing in the prosody logs for cloud_notify is "Module Loaded" so I don't think I am getting to step 2.

Tapping reset will send the below disable request, but the app never sends an enable request.

<iq type="set" id="ABCDABCD-ABCD-ABCD-ABCD-ABCDABCD"><disable xmlns="urn:xmpp:push:0" jid="pubsub.chatsecure.org"/></iq>

When tapping Reset, a packet trace shows:

  1. XMPP+TLS packets to/from prosody (disable request/reply)
  2. DNS lookup for push.chatsecure.org
  3. HTTPS session to push.chatsecure.org (maybe 2 or 3 requests in that session)
  4. No traffic to prosody after the HTTPS session

Looking at the device console in XCode I can see the following message:

ChatSecure(libswiftFoundation.dylib)[277] <Notice>: Unable to register this device

It appears that the app is failing to register the device with push.chatsecure.org. Any ideas what would cause this or how I can debug it further?

@chrisballinger

This comment has been minimized.

Member

chrisballinger commented Nov 13, 2017

Wait, are you running this in the Xcode Simulator or on an actual device? The only way push registration will work is if you run the official App Store or TestFlight builds on a real device.

@RoundOrange

This comment has been minimized.

RoundOrange commented Nov 13, 2017

The device is a real iPhone 8 with the app installed from the App Store. The log message is from the device console in "Devices and Simulators" with the iPhone connected by cable, not a debug run.

@chrisballinger

This comment has been minimized.

Member

chrisballinger commented Nov 13, 2017

Hm. There shouldn't be logs shown at all because we disable logging for production builds, perhaps one snuck through using NSLog or something.

Could you try uninstalling and reinstalling the app?

@RoundOrange

This comment has been minimized.

RoundOrange commented Nov 13, 2017

I have:

  1. Uninstalled the app
  2. Rebooted the phone
  3. Installed the app from the App Store (version 4.2.1)
  4. Setup the account with 'Add Existing Account'
  5. Tapped 'Enable Push'
  6. Allow Notifications
  7. Tapped 'Push Warning' at the bottom of the screen
  8. "Device Not Registered" message shows

Trying a reset again only repeated what I reported earlier (disable sent to prosody, but not enable).

At no time did an enable request get sent to prosody (I currently have the rawdebug plugin installed).

Does step 1 in the push flow rely on any configuration on my prosody server or DNS, or does it only involve the device, your server and Apple?

@chrisballinger

This comment has been minimized.

Member

chrisballinger commented Nov 13, 2017

Step 1 relies just on the device, Apple, and our push API server.

@RoundOrange

This comment has been minimized.

RoundOrange commented Dec 7, 2017

I have tested again with iOS 11.2 and the issue continues. I have also tried the user's iPad and get the same problem.

@chrisballinger

This comment has been minimized.

Member

chrisballinger commented Dec 7, 2017

Do any other apps work with push notifications? Are they signed in with an Apple ID? I've never seen this before except in the iOS simulator where Apple's push notification APIs don't work.

@RoundOrange

This comment has been minimized.

RoundOrange commented Dec 7, 2017

I got a 7 day trial from https://pushover.net/ and was able to successfully send a message to the iPhone. Both iPhone and iPad are signed in with the same Apple account. I have reinstalled ChatSecure again and it still fails with the message "Device Not Registered".

@chrisballinger

This comment has been minimized.

Member

chrisballinger commented Dec 7, 2017

Very strange...

Can you access https://push.chatsecure.org/api/v1/ from Safari on the affected device?

@RoundOrange

This comment has been minimized.

RoundOrange commented Dec 8, 2017

Yes, I can access that URL from both devices. I have tried a different Apple ID on the phone (that was fun) and nothing changed. I also tried the iPad with personal hotspot and got the same problem.

@User001111

This comment has been minimized.

User001111 commented Feb 25, 2018

Me and my friends have the same issue since last friday, used CS for a long time no issues untill last friday.
We all have the same issue; XEP0357 push error.
I’ve tried other server providers and the issue stay or with a couple other i cant even register my account it says: Cant connect to Xmpp server.
The servers that do register all show XEP 0357 error
I’ve tried almost everything, re-install the app, reboot, other servers, reset push.

@antonyablonsky

This comment has been minimized.

antonyablonsky commented May 13, 2018

@RoundOrange how did you connect pushover?

@RoundOrange

This comment has been minimized.

RoundOrange commented May 13, 2018

@antonyablonsky Unfortunately I was never able to resolve this issue. If you are affected by this issue, there is nothing you can do. It appears to be a problem between ChatSecure's push messaging servers and Apple's servers. It could be an iOS bug.

@chrisballinger

This comment has been minimized.

Member

chrisballinger commented May 13, 2018

@RoundOrange There is plenty you can do! You should install the latest version of mod_cloud_notify on your server and use:

push_notification_important_body = "New Message!"

If you don't enable that option, pushes will not pass through to your devices.

@RoundOrange

This comment has been minimized.

RoundOrange commented May 13, 2018

@chrisballinger I don't get that far. My prosody server never receives a push token from the device. Registering for push messaging fails at the first step. I don't see how upgrading the server will help if it never receives the token in the first place.

@chrisballinger

This comment has been minimized.

Member

chrisballinger commented May 14, 2018

You might want to try again. I made some major improvements to server capacity on Saturday.

@RoundOrange

This comment has been minimized.

RoundOrange commented May 19, 2018

I have retested again and the "Device Not Registered" message remains.

@Echolon

This comment has been minimized.

Echolon commented Jul 28, 2018

Hi,

just started an EtherCalc Pad to collect information about your and others experience about push. Feel free to add your data or additional columns (suggest only to add columns where the information can be given from a normal user)

https://ethercalc.org/29iyo1nunqdp

Cheers

@licaon-kter

This comment has been minimized.

Contributor

licaon-kter commented Oct 28, 2018

I just installed/reinstalled for some users and (at least) after account setup, push stays "unregistered".

I guessed that I might need to send some messages first, but I forgot to check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment