Skip to content
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 when ChatSecure is totally off #930

Open
br0xpl opened this issue Jan 13, 2018 · 18 comments
Open

Push when ChatSecure is totally off #930

br0xpl opened this issue Jan 13, 2018 · 18 comments

Comments

@br0xpl
Copy link

br0xpl commented Jan 13, 2018

Hi,
I have a question:
Is it normal that the push notification are delivered correctly when the app is in background.

But if I close the app (totally even from background by swiping out in task manager) the push doesn't work? Is this normal? Can I somehow get the messages even when the app is closed? E.g. the Whatsapp works this way -> even if off push works..

Thanks!

@Echolon
Copy link

Echolon commented Jan 13, 2018

Hi,
next time first search for existing issues please: #770
There you find the big discussion.

@chrisballinger
Copy link
Member

To be fair this should be better documented in a FAQ somewhere because it's asked all the time, and the fix involves a non-standard server patch to mod_cloud_notify and that isn't part of the XEP-0357 spec.

@br0xpl
Copy link
Author

br0xpl commented Jan 13, 2018

Sorry I have read #770 about 100 times again and again.. I'm using the ejabberd not the prosody and the issue does not seem exactly what i'm having... the push works quite well when the app is on.. but if off it simply does not arrive.

I was trying to find a similar issue about no push when ChatSecure is closed from background but I couldn't find one and thus I posted it.

After I turn it on it gets all the pushes again.

If this is #770 then what should I do to make it work in ejabberd? is this the @weiss patched mod_push? The mod_push has been merged into ejabberd so what exactly is required to be done to make it work?

I'm using ejabberd 18.01, latest stable which seems to have merged the @weiss push here: processone/ejabberd#1881

@chrisballinger
Copy link
Member

With ejabberd you need mod_push, but as far as how to use / configure it I'm not sure. Can you run https://github.com/iNPUTmice/ComplianceTester against your server and check if XEP-0357 is marked as supported?

@br0xpl
Copy link
Author

br0xpl commented Jan 14, 2018

Done:

Use compliance suite 'Advanced Server Core Compliance Suite' to test jabber.br0x.pl

running XEP-0115: Entity Capabilities…          PASSED
running XEP-0163: Personal Eventing Protocol…           PASSED
passed 2/2

Advanced Server Core Compliance Suite: PASSED


Use compliance suite 'Advanced Server IM Compliance Suite' to test jabber.br0x.pl

running XEP-0115: Entity Capabilities…          PASSED
running XEP-0163: Personal Eventing Protocol…           PASSED
running Roster Versioning…              FAILED
running XEP-0280: Message Carbons…              PASSED
running XEP-0191: Blocking Command…             PASSED
running XEP-0045: Multi-User Chat…              PASSED
running XEP-0198: Stream Management…            PASSED
running XEP-0313: Message Archive Management…           FAILED
passed 6/8

Advanced Server IM Compliance Suite: FAILED


Use compliance suite 'Advanced Server Mobile Compliance Suite' to test jabber.br0x.pl

running XEP-0115: Entity Capabilities…          PASSED
running XEP-0163: Personal Eventing Protocol…           PASSED
running XEP-0198: Stream Management…            PASSED
running XEP-0352: Client State Indication…              PASSED
running XEP-0357: Push Notifications…           PASSED
passed 5/5

Advanced Server Mobile Compliance Suite: PASSED


Use compliance suite 'Conversations Compliance Suite' to test jabber.br0x.pl

Server is ejabberd 18.01
running XEP-0115: Entity Capabilities…          PASSED
running XEP-0163: Personal Eventing Protocol…           PASSED
running Roster Versioning…              FAILED
running XEP-0280: Message Carbons…              PASSED
running XEP-0191: Blocking Command…             PASSED
running XEP-0045: Multi-User Chat…              PASSED
running XEP-0198: Stream Management…            PASSED
running XEP-0313: Message Archive Management…           FAILED
running XEP-0352: Client State Indication…              PASSED
running XEP-0363: HTTP File Upload…             FAILED
running XEP-0065: SOCKS5 Bytestreams (Proxy)…           FAILED
running XEP-0357: Push Notifications…           PASSED
running XEP-0368: SRV records for XMPP over TLS…                FAILED
running XEP-0384: OMEMO Encryption…             PASSED
running XEP-0313: Message Archive Management (MUC)…             FAILED
passed 9/15

Conversations Compliance Suite: FAILED

Seems push works fine, right?

Do you suggest I should switch from ejabberd to prosody?

Thanks for the quick replies, guys!

@chrisballinger
Copy link
Member

Hm, looks like it should be fine, but you might want to enable MAM / MAM-MUC once we ship a stable release with client support for it.

@br0xpl
Copy link
Author

br0xpl commented Jan 15, 2018

@chrisballinger : so what could be the problem that when I force close the ChatSecure app in iOS the notifications don't get to my phone.. In the ejabberd I see that the offline message causing the iq request to push.chatsecure.org like this:

<iq to='pubsub.chatsecure.org' from='jabber.br0x.pl' type='set' id='rr-15158 39470578-16963580929817451129-ELbsuBxm4trBVpba4XrhUo7DNpo=-ejabberd@localhost'><pubsub xmlns='http://jabber.org/protocol/pubsub'><publish node='568F001F-1291-4EA1-882F-BB0F187A12D E'><item><notification xmlns='urn:xmpp:push:0'/></item></publish><publish-options><x type='submit' xmlns='jabber:x:data'><field var='FORM_TYPE'><value>http://jabber.org/protocol/p ubsub#publish-options</value></field><field var='token'><value>8ca4eee0d0f7f778fbb998b48e8896a620ed7a6b9</value></field><field var='endpoint'><value>https://push.chatsecure.org/api /v1/messages/</value></field></x></publish-options></pubsub></iq>

If the app is in background - even very long - the push works correctly.

@weiss
Copy link

weiss commented Jan 15, 2018

The non-standard change mentioned above tells ChatSecure's push service to use a different type of APNS notifications. This type has the downside that the user will only see "New Message!" notifications on his lock screen, but it works more reliable. I have plans to add this change to ejabberd's mod_push, but it's not done yet.

@chrisballinger
Copy link
Member

@weiss Actually there's not a downside because it works side by side with the existing infrastructure, so I send out two APNS pushes for each push iq, one foreground one background. This way there's still a chance the app will wake up in the background.

@br0xpl This is my patch for Prosody's push module: chrisballinger/prosody-modules@4048627

@weiss
Copy link

weiss commented Jan 15, 2018

I send out two APNS pushes for each push iq, one foreground one background. This way there's still a chance the app will wake up in the background.

Oh nice, I wasn't aware.

If the app does wake up, is it able to edit/replace the "New Message!" notification(s) after fetching the actual message(s)?

@chrisballinger
Copy link
Member

@weiss Yep!

@dholl
Copy link

dholl commented Mar 6, 2018

@br0xpl - Have you had any luck?

@chrisballinger - Hello! I suspect I'm having a similar issue to @br0xpl.

Should I post in this thread or over in #770?

Specifically, my friend has an iPhone 8 (iOS 11.2.6), and he's been having trouble receiving notifications of my messages. Sitting with him today, we found that a way to guarantee not receiving any messages is to double press the home button and then swipe out ChatSecure from task manager as @br0xpl described in his first post here. I'd love to help get to the bottom of this. Do you have any tips for what I should investigate? (While I don't happen to own an iPhone, I do have a MacBook and love to code... I'm just not familiar with iOS development.)

I'm running Prosody 0.10.0-1 (Debian amd64) with mod_cloud_notify from chrisballinger/prosody-modules@4048627 -- a tip I gathered from reading this thread as well as #770. I've also tried Settings -> Account Details (i) button -> Server Features -> Push -> Reset on the iPhone.

On my end, I'm running Conversations 1.23.8.

I've also run ComplianceTester-0.2.3.jar, and get these happy results:

Use compliance suite 'Advanced Server Core Compliance Suite' to test ad5ey.net

running XEP-0115: Entity Capabilities…		PASSED
running XEP-0163: Personal Eventing Protocol…		PASSED
passed 2/2

Advanced Server Core Compliance Suite: PASSED


Use compliance suite 'Advanced Server IM Compliance Suite' to test ad5ey.net

running XEP-0115: Entity Capabilities…		PASSED
running XEP-0163: Personal Eventing Protocol…		PASSED
running Roster Versioning…		PASSED
running XEP-0280: Message Carbons…		PASSED
running XEP-0191: Blocking Command…		PASSED
running XEP-0045: Multi-User Chat…		PASSED
running XEP-0198: Stream Management…		PASSED
running XEP-0313: Message Archive Management…		PASSED
passed 8/8

Advanced Server IM Compliance Suite: PASSED


Use compliance suite 'Advanced Server Mobile Compliance Suite' to test ad5ey.net

running XEP-0115: Entity Capabilities…		PASSED
running XEP-0163: Personal Eventing Protocol…		PASSED
running XEP-0198: Stream Management…		PASSED
running XEP-0352: Client State Indication…		PASSED
running XEP-0357: Push Notifications…		PASSED
passed 5/5

Advanced Server Mobile Compliance Suite: PASSED


Use compliance suite 'Conversations Compliance Suite' to test ad5ey.net

Server is Prosody 0.10.0
running XEP-0115: Entity Capabilities…		PASSED
running XEP-0163: Personal Eventing Protocol…		PASSED
running Roster Versioning…		PASSED
running XEP-0280: Message Carbons…		PASSED
running XEP-0191: Blocking Command…		PASSED
running XEP-0045: Multi-User Chat…		PASSED
running XEP-0198: Stream Management…		PASSED
running XEP-0313: Message Archive Management…		PASSED
running XEP-0352: Client State Indication…		PASSED
running XEP-0363: HTTP File Upload…		PASSED
running XEP-0065: SOCKS5 Bytestreams (Proxy)…		PASSED
running XEP-0357: Push Notifications…		PASSED
running XEP-0368: SRV records for XMPP over TLS…		PASSED
running XEP-0384: OMEMO Encryption…		PASSED
running XEP-0313: Message Archive Management (MUC)…		PASSED
passed 15/15

Conversations Compliance Suite: PASSED

And does this screenshot help at all?
img_2023 copy

So, I'm just scratching my head and wondering what other secret sauce I'm missing... :)

Thank you for your help!

Update: I'll try again tomorrow now that I've enabled a few more modules:

        "smacks"; -- XEP-0198 http://modules.prosody.im/mod_smacks.html
        "smacks_offline"; -- https://wiki.debian.org/InstallingProsody
        "csi"; -- XEP-0352 http://modules.prosody.im/mod_csi.html
        "throttle_presence"; -- XEP-0352 https://wiki.debian.org/InstallingProsody
        "filter_chatstates"; -- XEP-0352 https://wiki.debian.org/InstallingProsody
        "http_upload"; -- XEP-0363 http://modules.prosody.im/mod_http_upload.html
        "cloud_notify"; -- XEP-0357 https://modules.prosody.im/mod_cloud_notify.html
        "mam"; -- Store messages in an archive and allow users to access it
        "omemo_all_access"; -- https://github.com/iNPUTmice/omemo_all_access
        "pinger";
        -- "pubsub" enabled via Compoment

(before, I was missing pinger, throttle_presence, filter_chatstates, and pubsub...)

Also, I was getting errors like

Mar 05 05:02:28 mod_c2s error   Traceback[c2s]: /usr/lib/prosody/modules/mod_s2s/s2sout.lib.lua:52: attempt to call field 'resolver' (a nil value)

until I commented out RunScript "use_unbound.lua" and s2s_auth_dane.

@br0xpl
Copy link
Author

br0xpl commented Mar 6, 2018

@dholl: the thread relates to ejabberd rather than prosody. You should rather look at #770 for prosody.

I have switched to prosody 0.10 from @chrisballinger repo and the cloud notify works quite well even if the app is closed. Sometimes I get too many pushes but the reset helps to clear this issue out.

@weiss, @chrisballinger : do we close the issue, or we leave it open to find somebody to fix ejabberd pushes?

@weiss
Copy link

weiss commented Apr 17, 2018

I have plans to add this change to ejabberd's mod_push, but it's not done yet.

It is, now.

@zuglufttier
Copy link

I'm using mod_push in ejabberd from @weiss and push seems to be reliable.

But most of the time, the notification text does not get replaced. I observed that the true message body is only displayed if ChatSecure is not in the background.

@weiss
Copy link

weiss commented Apr 19, 2018

But most of the time, the notification text does not get replaced.

I also see the case where I get two notifications for a single message, i.e. I then see both a "New Message!" notification and another one that shows the actual message body. So it seems for me, this doesn't (always?) work:

If the app does wake up, is it able to edit/replace the "New Message!" notification(s) after fetching the actual message(s)?

@chrisballinger
Copy link
Member

The text cannot be replaced on the static notifications. We do try to clear out all of the static notifications when the app is launched, and then put out local notifications that have message content.

@sebastiansterk
Copy link

I'm having the same issue, when chatsecure is closed (not running in the background), no message arrives. I'm using prosody and have cloud_notify configured.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants