Rocket.Chat.ReactNative icon indicating copy to clipboard operation
Rocket.Chat.ReactNative copied to clipboard

Push notice delay

Open AgentTNT opened this issue 6 years ago • 19 comments

  • Your Rocket.Chat Experimental app version: 4.6.4
  • Your Rocket.Chat server version: 3.2.1
  • Device (or Simulator) you're running with: Samsung Note10+

With the new changes for the push logic introduced in 3.2.0, there is a delay with messages on android.

Steps to reproduce:

  1. Sign into a mobile device and ensure there are no other sessions for this user (desktop/web browser)
  2. Send a message to a user
  3. Navigate to the home screen for the phone/tablet

User is placed in "away" state while the app is still active in the background. With the new notification logic, if the remote user responds to the message after the mobile app is no longer "in front", there is the delay of up to 120 seconds for the push to come in.

If the app is swiped closed from the list of running apps, user presence is set to offline immediately and any notices come in without delay.

This makes having a conversation more difficult in real time.

Changes in "background activity" for the battery options with the app do not change the above behavior.

Is it possible to set the user status to offline once the mobile app is not the forefront app? I can see the logic for setting the user to away, but feel as if this was an unintended side effect of the changed notification logic.

AgentTNT avatar May 11 '20 16:05 AgentTNT

@AgentTNT We're working on a fix. Thanks for letting us know.

diegolmello avatar May 11 '20 17:05 diegolmello

Thanks @diegolmello!

AgentTNT avatar May 11 '20 17:05 AgentTNT

Is it possible to set the user status to offline once the mobile app is not the forefront app?

I think, that 2 minutes it is a not so big delay, but I agree with @AgentTNT that when application is minimized, user can't write messages and it is really like user is offline. And that change will remove that delay, which is very good. So, setting offline status on applications go to background sounds like good idea!

ankar84 avatar May 12 '20 05:05 ankar84

Had some more thoughts to add to this...

Even if the mobile app sets the presence to offline immediately, if the user is idle on another desktop/web session then the 2m timer will start again since that user will be placed in the new idle state after being flipped from just Active via the mobile.

Perhaps the logic should be changed to treat idle states the same as offline and send the push immediately? I can see some potential downside to this with some more "noise".

AgentTNT avatar May 12 '20 14:05 AgentTNT

Perhaps the logic should be changed to treat idle states the same as offline and send the push immediately? I can see some potential downside to this with some more "noise".

That's not good. Previously was RC server settings Always send push notification and was so horrible. Someone writes you in open chat and you get push for that, it's very annoying. See https://github.com/RocketChat/Rocket.Chat/issues/16867

ankar84 avatar May 13 '20 12:05 ankar84

I think there may be a bit of a misunderstanding. I do not want the functionality back to always push. I am in agreeance with 2/3 of the new states:

  • If online and message not read, start 2m timer to send push
  • If offline send push immediately.

The one I do not agree with is count backwards from when the user was last active and start the 2m to send the push.

If we were to treat this the same as Hangouts/Slack, if I'm on mobile and using this to send messages while I have an idle desktop session, I would expect the notices to come to my phone immediately if the app is not opened.

But the issue comes up when the user is signed into both mobile and has a lingering idle session elsewhere. Every time the user goes active on mobile, it starts that new 2m countdown from the last moment they were active due to the idle session elsewhere, even if there is a fix implemented in the mobile app to set user status to offline if not in the forefront.

Example, if sending 5 messages in the scenario as described above, and relying solely on the push notice being the indicator a new message has arrived and not constantly checking the mobile app, the conversation duration is now at least 10m.

AgentTNT avatar May 13 '20 15:05 AgentTNT

I have same issue on iphone 7 (13.3.1). I use rocket chat for job. I must press the app to received messages on time from 5 min to 5 minutes 432891F1-E7B0-4964-9F78-0AD2B8877214

@AgentTNT We're working on a fix. Thanks for letting us know.

AndreeaR6 avatar Jun 15 '20 18:06 AndreeaR6

I'm not sure if this is still in the works or if it's been forgotten, but I figured I'd chime in. As of the time of writing, push notifications are still laggy. It makes conversations move very slow and is a huge gripe that all of my mobile users have. I love this software but having a 2-minute average delay between notifications means that a conversation that runs just ten messages takes twenty minutes at minimum. Since when you send your message, that's two minutes before the other user is notified. You're not gonna sit there and wait for their attention, so you switch to another app... And when they reply, that's two more minutes before you see it. At least four minutes from when you sent your message before you get your response. In practice, this is, more often than not, somewhere around 6-8 minutes. It really makes conversations drag on and on. For example, messaging my fiance to ask her to grab something at the store - often by the time she gets the notification she's put away her phone, figuring that I'm just not available.

I don't know exactly what the logic is on the push notifications, but ideally they would be instantly sent. Obviously the logic needs to be different when there's multiple listening devices, but the 2 minute timer is far too long. Would it be possible to, rather than force all servers to have the same timer, expose this as a variable in the admin page for Push? I feel as if you'll always have people disagreeing on whatever value it's set at, because everyone's going to have different uses.

Hell, even having a toggle for something like "Allow user specific push timer", a "Default user push timer" and a minimum and maximum variable exposed to the user panel, with a "Time before sending push" variable exposed to the user would be preferable.

All I know is that many of my users will end up taking their chats to other services if push notifications take as long as they do. Right now we are a small group while we finish development, but once we release, long waits for push notifications could easily be a reason for our potential users to simply go elsewhere. Consider exposing these variables and allowing the user to choose their own, if the server admin enables that functionality.

atlasveldine avatar Jul 04 '20 06:07 atlasveldine

Hello, Thank you very much for testing the app. I cant uninstall because is for work, but should worked asap at this. Use development testing or hire more people.On desktop, they came indeed very fast(under 6sec).If you are logged on mobile and desktop: notifications will came first on desktop -6 sec., than on mobile - 1.20minute (which is very long). If you are only on iphone mobile logged : 1minute (again, is long). I tryed telegram, but is horror ( its so.. basic :( ).Whatsapp: same. So, pls, make it done. I am using for bussiness purpose only and as far as i know, is app payed by my company.

În sâm., 4 iul. 2020 la 09:26 sephwalker56 [email protected] a scris:

I'm not sure if this is still in the works or if it's been forgotten, but I figured I'd chime in. As of the time of writing, push notifications are still laggy. It makes conversations move very slow and is a huge gripe that all of my mobile users have. I love this software but having a 2-minute average delay between notifications means that a conversation that runs just ten messages takes twenty minutes at minimum. Since when you send your message, that's two minutes before the other user is notified. You're not gonna sit there and wait for their attention, so you switch to another app... And when they reply, that's two more minutes before you see it. At least four minutes from when you sent your message before you get your response. In practice, this is, more often than not, somewhere around 6-8 minutes. It really makes conversations drag on and on. For example, messaging my fiance to ask her to grab something at the store - often by the time she gets the notification she's put away her phone, figuring that I'm just not available.

I don't know exactly what the logic is on the push notifications, but ideally they would be instantly sent. Obviously the logic needs to be different when there's multiple listening devices, but the 2 minute timer is far too long. Would it be possible to, rather than force all servers to have the same timer, expose this as a variable in the admin page for Push? I feel as if you'll always have people disagreeing on whatever value it's set at, because everyone's going to have different uses.

Hell, even having a toggle for something like "Allow user specific push timer", a "Default user push timer" and a minimum and maximum variable exposed to the user panel, with a "Time before sending push" variable exposed to the user would be preferable.

All I know is that many of my users will end up taking their chats to other services if push notifications take as long as they do. Right now we are a small group while we finish development, but once we release, long waits for push notifications could easily be a reason for our potential users to simply go elsewhere. Consider exposing these variables and allowing the user to choose their own, if the server admin enables that functionality.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/RocketChat/Rocket.Chat.ReactNative/issues/2102#issuecomment-653728313, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEOLWCDKKSMNUFIMOTLKZF3RZ3DTFANCNFSM4M6CG77Q .

-- Savu Andreea

AndreeaR6 avatar Jul 04 '20 08:07 AndreeaR6

Make sure you're running Rocket.Chat server 3.4.0+ A fix was released on https://github.com/RocketChat/Rocket.Chat/pull/17669

diegolmello avatar Jul 06 '20 12:07 diegolmello

@sephwalker56 Did you try changing the default delay mentioned on the PR?

diegolmello avatar Jul 06 '20 14:07 diegolmello

@sephwalker56 Did you try changing the default delay mentioned on the PR?

Sorry -- didn't see you'd responded, wanted to test that, hence the deleted messages. I misunderstood and thought it was for just emails, until I dug into the further PRs.

But yes, I've set all three environment variables to 1. Just tested it and it's still quite delayed. One user only received 2 of 10 push messages sent after closing out of mobile app. Still testing it further, once my other admin finishes up his morning routine, but it really doesn't appear to have made much of a difference. They seem... maybe a little bit faster? But still very slow. And it's my understanding having them set to 1 should, more or less, push all unread messages literally 1 second after they've been sent, if they're unread, right?

Edit: It seems to be working now. I'll test it further and see if I can't find the right settings for our server. My apologies for the misunderstanding and thank you for your patience. <3

atlasveldine avatar Jul 06 '20 14:07 atlasveldine

Np. Feel free to create another issue if you have more questions. Thanks for the feedback.

diegolmello avatar Jul 06 '20 15:07 diegolmello

i used to have this issue on mobile. I make upload from appstore?

În lun., 6 iul. 2020 la 18:03 Diego Mello [email protected] a scris:

Np. Feel free to create another issue if you have more questions. Thanks for the feedback.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/RocketChat/Rocket.Chat.ReactNative/issues/2102#issuecomment-654293391, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEOLWCEHOWHIE3EYCS5NQRLR2HRV3ANCNFSM4M6CG77Q .

-- Savu Andreea

AndreeaR6 avatar Jul 06 '20 15:07 AndreeaR6

Can I find this settings somewhere in the documentation?

mcs avatar Jul 29 '21 05:07 mcs

Can I find this settings somewhere in the documentation?

Only here https://github.com/RocketChat/Rocket.Chat/pull/17669

ankar84 avatar Jul 29 '21 05:07 ankar84

In the latest release (5.3.4) it is still 120 seconds delay. https://github.com/RocketChat/Rocket.Chat/blob/5.3.4/apps/meteor/app/notification-queue/server/NotificationQueue.ts#L12 Everybody from our team saying that mobile is delayed. Why to not just set this value to 0-10?

pisarkov avatar Nov 29 '22 20:11 pisarkov

At the time of this issue, we investigated the current values and it was working as intended. I tested quickly again and it's still the same.

Both on Android and iOS:

  • Open the app with user presence online
  • Move it to background without closing and the user presence is now away
  • Send a message from another user
  • Push notification is sent instantly

On the code @pisarkov sent above, the delay is specifically for online user presence. It's a matter of expectation:

  • While the app is open and online, I don't expect to receive push notifications, so all new messages come as in-app notifications
  • While web/desktop is open and online, I don't expect to receive push notifications immediately, because the client is going to receive alerts from browser/OS. That's why we delay them in 120 seconds.

Please correct me if I'm wrong, if this is not what's happening for you or if you have a better idea for the product. Thanks!

diegolmello avatar Nov 29 '22 21:11 diegolmello

It's a matter of expectation:

  • While the app is open and online, I don't expect to receive push notifications, so all new messages come as in-app notifications
  • While web/desktop is open and online, I don't expect to receive push notifications immediately, because the client is going to receive alerts from browser/OS. That's why we delay them in 120 seconds.

Totally agree with Diego that this works as expected now. Push notification on already read messages just annoying.

Why to not just set this value to 0-10?

You configure that with this options on server side:

      - NOTIFICATIONS_WORKER_TIMEOUT=2000
      - NOTIFICATIONS_BATCH_SIZE=150
      - NOTIFICATIONS_SCHEDULE_DELAY_ONLINE=300
      - NOTIFICATIONS_SCHEDULE_DELAY_AWAY=0
      - NOTIFICATIONS_SCHEDULE_DELAY_OFFLINE=0

Most important to you could be NOTIFICATIONS_SCHEDULE_DELAY_ONLINE

ankar84 avatar Nov 30 '22 01:11 ankar84