Rocket.chat: Mobile Push Notifications not working properly

Created on 4 Apr 2016  路  51Comments  路  Source: RocketChat/Rocket.Chat

Your Rocket.Chat version: 0.24

The mobile push notifications on both iOS and Android aren't pushing for some reason. Push notifications are enabled for the app on the phone and on the Rocketchat website.

Is anyone else noticing this?

support

Most helpful comment

So there are actually a couple of different scenarios here.

Normal Notifications

It is technically working correctly.

Potential issue with current way:

Say I run out for a cup of coffee. I've only been gone for 4 minutes and someone sends me an urgent message that the server just crashed. I won't even see that message at all until I get back.

@twhiting I like that you brought up how slack is doing it.

That could make it so that it would happen like this:
So if notifications are un-read and status goes away, send to phone.

In my example i'd get alerted 1 minute later to my phone when my desktop connection was set to away.

But like I said this is technically working correctly. But the above would be an awesome solution to fix that. 馃槃

@RocketChat/core please consider this proposal @twhiting mentioned though 馃槃


Notify All Messages

Because of this option, this needs re-opened

screenshot 2016-04-08 at 12 03 19 am

If I choose to be notified on mobile and desktop of every message.... I should get notified of every message. So by this logic, regardless of the above, this is not functioning correctly.

I think this is the case that i've been personally finding so jarring. I have a couple of channels I want to be alerted regardless of status, so I have the above two settings set to deliver to desktop and mobile on all messages.

All 51 comments

@richardwlu just curious if you restart the server do they start to deliver again?

@geekgonecrazy I gave the server a restart but no changes

Also have had no mobile notifications for quite a while.

What version of the mobile app are you using? What happens when you try the test button on the admin panel?

we are using android primarily, when I click the test button we get a "Your push was sent to one device" without a notification ever actually reaching it. I've also heard complaints about not receiving notifications on our windows electron app. (We are running via docker, could that be the issue? no idea.)

Edit: i've also tried setting up the Google cloud messaging, to no avail.

Did you turn on DEBUG and looked into the View Logs?

Here is what the logs said:

Push: Send message "@twhiting" via query { userId: 'xxxx...' }
I20160405-17:40:11.214(0) send to token { gcm: 'xxxx...' }

Then nothing, no errors or anything.

We are going to have to do a joint test, so we can look at the logs on our gateway to try to pin point the failure.

Can you guys upgrade to 0.25.0 before that?

Yes, I'll update to 0.25.0 and will let you all know once its complete.

I was already on .25 what do you need from me @engelgabriel ?

Can you send a screenshot of your Push Notifications settings from the admin, blurring any keys, obviously.

capture

capture2

This is what I've found following the guide I've found in the wiki.
https://github.com/RocketChat/Rocket.Chat/wiki/Mobile-Notifications-Gateway-Configuration

GCM might require me to authenticate my server? I've tried to do this via the meta Google Site Verification setting, but with no luck. Another way to verify is to put an html page google generates in the root directory (https://chat..com/google-verify.html) but how would I go about doing that via a docker container?

I figured out my issue. I was referencing my server as a gateway when I do not have it set up correctly to be one. Using https://rocket.chat as a gateway fixed the issue for me and push notifications now work. I'm not sure if it fixes the other guy's problem to tho. (Found answer in issue #2431)

Thanks @twhiting! Glad to hear that!

Hey @richardwlu can you send a screenshot of your Push Notifications settings from the admin, blurring any keys, obviously.

@engelgabriel Sure thing! Sorry, I've been pressed on available time.

screen shot 2016-04-07 at 12 54 28 pm

2016-04-07 17:45:21 586: [methods] push_test -> userId: xxx , arguments: {} 2016-04-07 17:45:22 210: Push: Send message "@richlu" via query { userId: 'xxx' } 2016-04-07 17:45:22 211: send to token { apn: 'xxx' }

The Test Push Notification To My User works as I am receiving it on my iOS device; however, notifications are not working besides test push. We tried direct messages and setting push notifications to All

Can confirm, neither are any other push notifications working on our end besides just a test push. I didn't think to check that once I had a successful test push.

This sounds odd, but try to click the Logout from other logged in locations under My Account->Profile. Then log in via your phone, go offline, actually close your opened instance of Rocket.chat, and then have someone private message you. Just to see if for some reason there is an open session which is causing you to not get the notifications since the test push is working.

@graywolf336 Ok, we tried that and found out:

  1. Logging out of the other instances, logging back into mobile app, and closing the web browser session pushes to iOS successfully from a direct message
  2. After that successful push, I opened a web browser session and a push from a direct message was unsuccessful
  3. Then, I closed the web browser session and another push from a direct message was unsuccessful

So that is working correctly. You are not expected to get push notification when you are already online on other devices.

@engelgabriel When we used Slack, if you didn't recieve a notification on your computer (whether you were running it or not) eventually it would send a push notification to your phone to notify you since we are obviously away from our computer at that point. This type of behaviour would be highly appreciated for us. We never log out of rocket.chat on our computers because they are on all the time (so we can remote into them from home) therefore, we will never get push notifications.

Is it still appropriate that when I closed my other web browser sessions that I still don't receive pushes?Because if so, I would be required to logout of my other instance and relogin into the mobile app when I am heading out.

Lastly, is there any talk of allowing pushes to work even when a user is online since there are times when users have stepped away but would like to be notified of messages.

After 5 minutes of inactivity, a device is considered AWAY.
You dont need to be logged out, you just need to be AWAY or OFFLINE in ALL devices to receive pushes.

@engelgabriel Then I say we have an issue, because thats definitely not working on my end. I'm going to guess its the same way for @richardwlu

I've logged out of all locations except my phone for about the last hour and have not recieved a single notification w/ mobile push turned on in both private and public chats.

What presence status (green/yellow/red) do you appear to be to other users?

Having enough time to be Away and OFFLINE from my web session, the push worked for me. I'll have to give it a few days to see if this acts consistently.

Some people say that 5 minutes is too much. We want to make it configurable in the future.

And again, the system ignores your manually set presence status, it really needs to be 5 minutes away from ALL devices.

So there are actually a couple of different scenarios here.

Normal Notifications

It is technically working correctly.

Potential issue with current way:

Say I run out for a cup of coffee. I've only been gone for 4 minutes and someone sends me an urgent message that the server just crashed. I won't even see that message at all until I get back.

@twhiting I like that you brought up how slack is doing it.

That could make it so that it would happen like this:
So if notifications are un-read and status goes away, send to phone.

In my example i'd get alerted 1 minute later to my phone when my desktop connection was set to away.

But like I said this is technically working correctly. But the above would be an awesome solution to fix that. 馃槃

@RocketChat/core please consider this proposal @twhiting mentioned though 馃槃


Notify All Messages

Because of this option, this needs re-opened

screenshot 2016-04-08 at 12 03 19 am

If I choose to be notified on mobile and desktop of every message.... I should get notified of every message. So by this logic, regardless of the above, this is not functioning correctly.

I think this is the case that i've been personally finding so jarring. I have a couple of channels I want to be alerted regardless of status, so I have the above two settings set to deliver to desktop and mobile on all messages.

@geekgonecrazy Good catch, I have mobile push set to all messages so technically that should send everything to my phone, your right. Although I'm still not convinced that notifications are working on our end. I haven't received a single notification all day with every client logged out except my nexus 6p.

Like I noted, a slack like mobile notification system would be amazing for shops like ours and I think a general improvement to how rocket.chat notifications work. If I knew enough about javascript i'd try to do this myself but probably best someone else does. Look forward to this fix/feature. Thanks!

@twhiting I also spent a think a day or more trying to figure out why notifications weren't working :smile: Its really hard to test getting all sessions disconnected.

If you get them to your user when you do the push test it should be functional. If you don't even on the push test... then you might need to clear push tokens for your user. I can walk you through that if that is the case for you.

@geekgonecrazy When I click the "Send a test push to my user" button I do get the test notification on my phone. After I got that working I then clicked the log out of all locations button and then logged out/in on my android phone when I went to class today. I haven't received a single notification on my phone all day.

Thoughts?

+1, it's very confusing and annoying not getting notification for all messages even when it's set.
To be clear, the current issue is that it sends notifications only when you're away in all open sessions?

Actually there is something that doesn't seem to work at all. I've set the notifications of a channel to "All Messages" for both desktop and push. I don't have any open session. But I'm not getting any notification on posts.

@rore does you TEST button works for you?
Yes, the system only sends PUSH notifications when you are AWAY on ALL sessions.

Yes, test push works and I also get push on mentions or @all mentions, but no notification on messages even when "All messages" is set.

Can confirm with @rore I get the test notification but rarely get push notifications on my phone.

@engelgabriel Any confirmation on this bug?

We are investigating

We're on 0.32 and the rocket.chat push gateway seems not to work at all for us, whereas it did for 0.30.
I get a "There are no tokens for this user" and debug is not very verbose:
I20160609-17:43:58.405(2) [publish] settings -> userId: z626jZUApQPoanyk , arguments: {}
Tested with several users and devices.
How can we test / debug that?

@rasos are you using a self installed RC or our hosting solution?

@rodrigok we use a self installed RC.

@rasos Can you verify if you have tokens consulting the collection _raix_push_app_tokens?

You can do a query to see if there are tokens for your user, example:

db._raix_push_app_tokens.find({ userId: 'MZiFvWAfF4RF4AD5u' });

You can get your userId going to your browser's developer tools console and executing

Meteor.userId()

@rodrigok Our sysadmin did the DB query for checking if the user has tokens: the result looks like we don't :

001-rs:PRIMARY> db._raix_push_app_tokens.find();
2016-06-12T21:44:01.770+0200 E QUERY TypeError: Cannot call method 'find' of undefined
at (shell):1:26

Or didn't we query correctly? Double checked the user ID, the user has at least 2 devices running with RC.

Can he do a show collections to check if the collection was created?

@engelgabriel The collection exists, including the push tokens:
001-rs:PRIMARY> show collections;
_raix_push_app_tokens
_raix_push_notifications
assets.chunks
assets.files
avatars.chunks
avatars.files
instances
meteor_accounts_loginServiceConfiguration
meteor_oauth_pendingCredentials
meteor_oauth_pendingRequestTokens
migrations
rocketchat_cron_history
rocketchat_livechat_page_visited
rocketchat_message
rocketchat_mr_statistics
rocketchat_oauth_apps
rocketchat_oembed_cache
rocketchat_permissions
rocketchat_roles
rocketchat_room
rocketchat_settings
rocketchat_statistics
rocketchat_subscription
rocketchat_uploads
rocketchat_uploads.chunks
rocketchat_uploads.files
system.indexes
users
usersSessions

Tested with another user, still no token for that user.
I20160614-16:45:41.782(2) [publish] stream-notify-user -> userId: mryk6PvxtsjTrfoGf , arguments: { '0': 'mryk6PvxtsjTrfoGf/notification', '1': false }
I20160614-16:45:41.787(2) [methods] raix:push-setuser -> userId: mryk6PvxtsjTrfoGf , arguments: { '0': 'ff8KjsTpXrEPB5GSZ' }
I20160614-16:45:49.904(2) [methods] getStatistics -> userId: mryk6PvxtsjTrfoGf , arguments: {}
I20160614-16:46:33.594(2) [methods] push_test -> userId: mryk6PvxtsjTrfoGf , arguments: {}

@engelgabriel @marceloschmidt what else can we do to identify the problem, that there are no tokens for users? I'm having now ssh access to the machine and can do more queries etc.

@rasos If the collection exists your error does not make sense

001-rs:PRIMARY> db._raix_push_app_tokens.find();
2016-06-12T21:44:01.770+0200 E QUERY TypeError: Cannot call method 'find' of undefined
at (shell):1:26

Can you try to list the tokens again?

Another question, are you using our mobile apps or have you compiled your own apps?

Reinstalled the app from here.
The miracle seems to be that the affected tablet uses Cyanogenmod and has no Google services installed. Without an active Google account, the device will never get any push message, right?

@rasos Yes, you are right, to get push notifications you should install the app via Google Play.

I will close this issue, please reopen it if you have more problems.

to get push notifications you should install the app via Google Play.

Good to know, if you install .apk file and wonder why there's no push notifications...

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  路  3Comments

amayer5125 picture amayer5125  路  3Comments

lunitic picture lunitic  路  3Comments

karlprieb picture karlprieb  路  3Comments

brendanheywood picture brendanheywood  路  3Comments