tigase / siskin-im

(M) Public Project of Tigase Messenger for iOS devices based on Tigase Swift XMPP library.
GNU General Public License v3.0
173 stars 37 forks source link

Siskin doesn't register push on login if none is setup #70

Open licaon-kter opened 3 years ago

licaon-kter commented 3 years ago

Details (please complete the following information):

I went back in time, and on Sep 23 the subscription was there in the DB.

But, on Sep 22, we talked in the support MUC about how this contact has 2 push subscriptions, for the newely installed Siskin and the old one for Monal. This was giving strange log results so I've looked up on how to delete the old one.

ejabberd has "delete_old_push_sessions" and on Sep 24 I've run ejabberdctl delete_old_push_sessions 0 early in the morning.

@weiss:

Deleting subscriptions shouldn't do real harm as clients re-register for push on the next login.

In theory...

In practice though, Monal (old and new) and Conversations re-registered just fine, but Siskin logged in and out several times since then, yet a push subscription was never recreated.

I'll ask the contact to disable/enable Push in settings, but as usual it might take a while.

Any thoughts?

weiss commented 3 years ago

Ah, sorry, I was assuming all clients re-register when opening a new session. Doing so allows servers to map push subscriptions to XMPP sessions in order to suppress notifications for connected clients.

hantu85 commented 3 years ago

Since version 6.0 SiskinIM checks if there is anything "requiring" reenabling push notifications (ie. chat notifications settings has changed) and if not then it will not try to reenable push notifications.

This change was intentional to reduce "load" on the XMPP server (additional requests every time XMPP-iOS clients logs in - so almost every time the app is opened).

Just to be clear - this behaviour is not a bug. Specification do not mention any requirement of "reenabling" push notifications on each login.

weiss commented 3 years ago

Does Tigase generate push notifications for a connected client? If it doesn't, how does it map the new session to a push subscription registered via a previous session?

hantu85 commented 3 years ago

Tigase sends push notifications if no client is connected.

licaon-kter commented 3 years ago

So I thought I'd just put back the entry in the DB and call it a day (it should just work, right?), but the Tigase entry looks like this: user mydomain.tld unixtimestamp push.tigase.im 01#longhexstring

While all the other: user mydomain.tld unixtimestamp push.chatsecure/monal/conversations xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx <x type='submit' xmlns='jabber:x:data'><field var='FORM_TYPE'><value>http://jabber.org/protocol/pubsub#publish-options</value></field><field var='secret'><value>sekret</value></field></x>

The form is not needed?

hantu85 commented 3 years ago

No, our push service works without a form, so your entry looks ok.

licaon-kter commented 3 years ago

I've INSTERTed it back in the DB, did not restart the server yet, but I've written one message just in case and later on the contact answered. Lucky coincidence? Dunno :+1:

Anyway will keep an eye on it.

@hantu85

This change was intentional to reduce "load" on the XMPP server (additional requests every time XMPP-iOS clients logs in - so almost every time the app is opened).

Sounds good, but this means the server is always perfect, a worthy though, not a reality. :)

weiss commented 3 years ago

this means the server is always perfect

It also means the XMPP server must choose one of two options to deal with multi-device scenarios:

  1. If at least one client is connected (e.g., a desktop client), don't notify any of your clients.
  2. Always notify all push-registered clients regardless of whether they're currently connected.

Tigase seems to prefer option (1). With (at least) ejabberd and Prosody, (2) will happen (which might lead to superfluous notifications on the phone, I guess?). (What ejabberd and Prosody try to implement is the third option of notifying only disconnected push clients, regardless of the connection status of other devices.)

hantu85 commented 3 years ago

Yes, you are correct. However, I'm considering switching to second option of always sending push notifications as it would simplify logic on the client side (should I present a notification from the XMPP stream? or was it already shown as there was a push notification already delivered?)