Push notifications iOS for background app (#464)
Unknown opened 4 years ago

Hi there, thanks for the great app. I am using siskin on iOS with openfire and have configured push notifications. Everything is working well when the app is open however if it put it into the background then notifications of messages are not received. Background app refresh is on however the app does not seem to refresh.

As soon as the app is brought back to the forefront then messages and push notifications come in.

I am using the latest version of the app 6.2. Is there something further that needs to be done to enable push to work when the app is in the background.

Thanks

Unknown commented 4 years ago

Enabled Push in app Settings?

Server side you see the push.tigase.im registration?

Any server logs?

Unknown commented 4 years ago

Hi licaon-kter,

Yes push is enabled in the app. See attached logs from the server.

What I can gather is that the server thinks that the client is offline (as if the app is closed) so the message is stored as offline but it should actually send a push notification as the app is in the background and not closed.

logs.txt

Appreciate your help. Thanks

Unknown commented 4 years ago

Technically the app is closed, but that's the point of the push system, to send the notification and revive the app as needed

@guusdk Thoughts?

Unknown commented 4 years ago

In provided logs, there is no push notification being sent to SiskinIM push notifications component (only to Monal) so Siskin cannot show notification which was not sent to it.

If you've observed push notifications issues mostly yesterday (there was an upgrade of our push notifications component), then I would suggest to try to disable it and reenable (after a few seconds) and check once again.

Unknown commented 4 years ago

I attempted to turn push on/off but no luck.

I also removed the 'openfire-callbackOnOffline' plugin and tested again. Attached is the log output I receive when trying to send a message to a recently put to background ios app.

Please let me know if further output would be useful. Thanks further logs.txt

Unknown commented 4 years ago

I think this exception may be suggesting an issue on your server:

2021.01.29 18:57:31 WARN [socket_c2s-thread-3]: org.jivesoftware.openfire.OfflineMessageStrategy - An exception occurred while dispatching a 'messageStored' event!
java.lang.ClassCastException: class org.igniterealtime.openfire.plugins.pushnotification.PushInterceptor$SentNotification cannot be cast to class org.igniterealtime.openfire.plugins.pushnotification.PushInterceptor$SentNotification (org.igniterealtime.openfire.plugins.pushnotification.PushInterceptor$SentNotification is in unnamed module of loader org.jivesoftware.openfire.container.PluginClassLoader @446907d7; org.igniterealtime.openfire.plugins.pushnotification.PushInterceptor$SentNotification is in unnamed module of loader org.jivesoftware.openfire.container.PluginClassLoader @531905e3)
at java.util.Collection.removeIf(Collection.java:576) ~[?:?]
at org.igniterealtime.openfire.plugins.pushnotification.PushInterceptor.wasPushAttemptedFor(PushInterceptor.java:263) ~[?:?]

but that would need to be verified by someone from OpenFire.

Unknown commented 4 years ago

I'll have a look into that error as it was not present before. thanks

Unknown commented 4 years ago

OK I have resolved the offline message exception. I think the issue may be to do with the callback URL for the CallbackOnOffline plugin. I am not sure if this plugin is needed for offline push and what to set the callback url to? As I said earlier, push is working fine if the app is open

See attached for the latest logs which have more information. Thank you log3.txt

Unknown commented 4 years ago

I have uninstalled the CallbackOnOffline plugin and am now receiving the same logs I first uploaded which licaon-kter reviewed.

Unknown commented 4 years ago

@pd888 I did not review anything :)

Just pinged people in the know.

tigase.org has cert issues now, not sure if it matters.

Unknown commented 4 years ago

@licaon-kter tigase.org domain is not used by push notifications and we are aware that it expired. It should be replaced soon

@pd888 In the new logs, the notifications are sent by Openfire only to Monal push notifications component and not to SiskinIM push component (they are not being sent to push.tigase.im nor push.sure.im).

As I said earlier, push is working fine if the app is open

When app is opened and connected, push notifications are not used at all!

Unknown commented 4 years ago

Ah okay that makes sense @hantu85 May be a silly question, but how can I configure Openfire to use push.tigase.im nor push.sure.im Is there a guide somewhere?

I am using this push plugin Latest version 0.7.0

thank you

Unknown commented 4 years ago

I have no knowledge about that, but if Openfire supports pushes correctly (and most likely it does), Siskin when you enable push notifications automatically tries to register for push notifications and forward all required details to Openfire.

Unknown commented 4 years ago

Okay thanks for the quick help, I will have a further look into it and update if I have any other questions

Unknown commented 4 years ago

I have done some further testing. Reinstalled the push plugin on the server and attempted to re-register/enable push in the siskin app on iphone. See initial connect attached file where you can see it connects successfully to push.tigase.im

However in the 2nd uploaded file 'trying to send' you can see it is again trying to connect to 'ios13push.monal.im' when I send a message to an offline user. I am not sure why it is doing this. initial push connect.txt trying to send.txt

Unknown commented 4 years ago

@pd888 do you also have Monal? If not, can you remove the monal push server reference?

Did you contact Openfire to ask for support too? Eg. xmpp:open_chat@conference.igniterealtime.org?join

Unknown commented 4 years ago

I did use monal as a test before I set up push but I dont use it any more. I will also contact open fire and see if they can help. thanks for the link

Unknown commented 4 years ago

Hi everyone. I'm looking at this from an Openfire perspective. Can someone tell me exactly when / under what conditions the client will attempt to enable notifications?

Unknown commented 4 years ago
Unknown commented 4 years ago

@guusdk only on in app toggle...umm...toggling :)

Ref: https://github.com/tigase/siskin-im/issues/70

Unknown commented 4 years ago

reenable.txt @guusdk

Unknown commented 4 years ago

@guusdk Client MAY and usually enable push each time they connect - to make sure that push is enabled for them.

In the logs posted by @pd888, I see that notifications are disabled for push.tigase.im(probably user interaction) and then reenabled for push.tigase.im. However, after reenabling Openfire reports user had push notifications enabled already and has 1 push notification service.

2021.01.29 23:17:15 TRACE [socket_c2s_ssl-thread-2]: org.igniterealtime.openfire.plugins.pushnotification.PushServiceManager - User 'pat' has 1 push notification services configured.
2021.01.29 23:17:15 DEBUG [socket_c2s_ssl-thread-2]: org.igniterealtime.openfire.plugins.pushnotification.Push0IQHandler - Push service 'push.tigase.im', node '01#1AAF44FCAC43F4F51A369AACFDF395BFF44CBE30968D791F37ED2A32F3292C26', for user 'pat' was already registered.

Push notifications are actually sent to ios13push.monal.im.

Unknown commented 4 years ago

The ClassCastException that is at least partially responsible will be fixed in the next version of the Openfire plugin (details). A work-around for this issue is to restart Openfire after updating or reloading the PushNotification plugin.

Unknown commented 4 years ago

I have rebuilt the server with openfire 4.5.4. I am no longer getting the class exception and the server has registered to push.tigase.im however push notifications to clients is still not working. See attached for latest logs.

Thanks 454logfile.txt

Unknown commented 4 years ago

In the provided log, I see notifications about enabling/disabling push notifications on the Openfire server, but no attempt to send a push notification.

Unknown commented 4 years ago

The Siskin iOS app shows that push is enabled for the user account but even when I toggle push on and off in the app I see no logs indicating on the server that push is on for the client. Then trying to message an offline client (on a device with push enabled) the message is stored for offline and server logs do not show the push notification plugin intercepting the message.

I am not sure how to force the plug-in to pick up the message of any way of enabling push on the client apart from toggling push to enabled in Siskin app

On 30 Jan 2021, at 10:16 pm, Andrzej Wójcik notifications@github.com wrote:

 In the provided log, I see notifications about enabling/disabling push notifications on the Openfire server, but no attempt to send a push notification.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

Unknown commented 4 years ago

The Siskin iOS app shows that push is enabled for the user account but even when I toggle push on and off in the app I see no logs indicating on the server that push is on for the client.

There are log entries indicating that in the log which you have provided.

The question is not: "Why the app is not showing a notification?" but "Why the server is not sending notification?"

I'm not familiar with Openfire internals to make any suggestions or provide you with a solution. It might be good to bring it up in the Openfire community and ask for some suggestions.

Unknown commented 4 years ago

I will debug further and also upgrade to the latest version of openfire once it is out. Thanks for your help

Unknown commented 4 years ago

@hantu85 wrote:

after reenabling Openfire reports user had push notifications enabled already

That was the clue that uncovered the root cause of the problem. The push notification plugin for openfire has a bug that incorrectly states that a particular push service has already been identified, if no options are provided (which Siskin apparently doesn't do, which is perfectly fine, as they're optional).

Unknown commented 4 years ago

For posterity: this was fixed in version 0.8.0 of the Push Notification plugin for Openfire (details). Thanks for your help guys!

issue 1 of 1
Issue Votes (0)
Watchers (0)
Reference
tigase/_clients/siskin-im#464
Please wait...
Page is in error, reload to recover