royneary / mod_push

Other
68 stars 19 forks source link

How does it work? #4

Closed bangarharshit closed 8 years ago

bangarharshit commented 8 years ago

How does xep-0357 works for offline messages for GCM. I believe GCM is itself an XMPP server and on my mobile I checked ping time to be very high (15 minutes on wifi and 28 minutes on mobile network). How is gcm useful for offline messages? The only usecase I can think of is for Android your service which contains the connection is killed frequently and restated after some time disconnecting you.

bangarharshit commented 8 years ago

Also wanted to know which ejabberd version are you guys planning to release. We are thinking of patching ejabberd master (which may not be super simple).

royneary commented 8 years ago

How does xep-0357 works for offline messages for GCM

You might want to read a blog article I wrote recently.

mod_push does not work for offline clients. It will initiate push notifications for clients which are in stream management's 'waiting for resumption' state (a.k.a. zombie state). The resume timeout is adjusted to a big timespan (at the moment it's 100 days). So mobile clients are expected to close their TCP connection, but their XMPP stream is kept by the server.

How is gcm useful for offline messages? The only usecase I can think of is for Android your service which contains the connection is killed frequently and restated after some time disconnecting you.

Push notifications are meant as a power saving mechanism. A client can close its TCP connection and then only react to push notifications. A typical reaction would be to connect to the XMPP server and pick up new stanzas. So push notifications can be used as a wake-up mechanism but XEP-0357 also allows including message contents in the push notifications. In the future Android might stop apps, it's called app standby. This might make keeping a permanent connection harder or impossible.

Also wanted to know which ejabberd version are you guys planning to release. We are thinking of patching ejabberd master (which may not be super simple).

I merged @processone's master into my ejabberd brach a few weeks ago, so it shouldn't be very hard to patch the current master. My ultimate plan is to merge my branch into their master.

bangarharshit commented 8 years ago

Oh. Thanks. It was a great explanation. I knew about IOS that we have to use such mechanism but was not aware about android. I wish they fix the issues with GCM - https://productforums.google.com/forum/#!msg/nexus/fslYqYrULto/lU2D3Qe1mugJ. Being a central source of truth I wish if they could have reduced ping time from 28 min (on my phone) to something sane.

bangarharshit commented 8 years ago

Just one more request it will be great if you can merge with latest release branch or approve a merge so that we have latest stable merge available.

bangarharshit commented 8 years ago

Wanted to comment on one more thing - http://xmpp.org/extensions/xep-0305.html. Current numbers from smack to start the connection - TCP connect incl. DNS-80ms Client-Server Initial Stream-420ms TLS RFC 6120 § 9.1.1-470ms SASL RFC 6120 § 9.1.2-160ms Compression XEP-138-190ms Stream Management XEP-198-80ms Roster retrieval using versioning-80ms Privacy List already set 60ms Total (Sum. Parts) 1750ms Total(Real) 1540ms.

I believe something like quickstart will be very useful in this scenario.

royneary commented 8 years ago

Just one more request it will be great if you can merge with latest release branch or approve a merge so that we have latest stable merge available.

The last two commits in branch mod_push_adjustments are the merge of my changes. There are only 5 commits between that and 15.09, so I guess it doesn't make much difference. Nevertheless you can revert those commits in order to get 15.09 with mod_push support.

By the way, mod_push does not use the XMPP interface you mentioned, but it uses the HTTP interface to talk to GCM.