User online/presence status are sometimes incorrect
- Your Rocket.Chat Official app version: 4.6.4.2118
- Your Rocket.Chat Experimental app version: -
- Your Rocket.Chat server version: 3.2.0, using helm chart, Kubernetes 1.16, nginx-ingress, and CloudFront
- Device (or Simulator) you're running with: Realme X2 Pro
- WebSocket supported: yes
User online/presence status are sometimes incorrect
This is the presence status list using web client: (which I say is correct)

However, React.Chat 4.6.4.2118 on Android shows this:

Users that have been offline for quite some time are (e.g. amran, andin) are still shown as online/away on Android.
Chatting still works.
What I've tried:
- In Android app, Settings > Clear local server cache. Still same.
- In Android app, Logout then Login again. Still same.
Example response headers given by https://chat.lovia.life/api/v1/users.presence?ids=rnPrRiZpmXbeH84wA,L6xY7zevMTcF6EKtJ,4D3zuTwXYsM6pE7y3,Brum53mQiSS7ttJnD: (note: some time has already passed)
cache-control: no-store
content-encoding: gzip
content-type: application/json
date: Sun, 03 May 2020 09:05:39 GMT
pragma: no-cache
server: nginx/1.17.8
status: 200
strict-transport-security: max-age=15724800; includeSubDomains
vary: Accept-Encoding
via: 1.1 e869415928b7de75c30c1dc3da361401.cloudfront.net (CloudFront)
x-amz-cf-id: dBM3hLtMiQDVn2He5LrKLSV7FXjy8NcBv7BGBEComDxP9M-lMwsSXA==
x-amz-cf-pop: SIN5-C1
x-cache: Miss from cloudfront
x-instance-id: ed3ZhwPXAs9K3BAYJ
x-xss-protection: 1
Same here. Is there any solution for this?
Hey guys, not yet, I'll try to take a look into this to the next release 4.8.0. If someone from community is interested at contribute, I think the logic to re-request the statuses when the websocket connection is lost should be changed. Thanks in advance.
Hi all! I too have same here bug. Is there any solution for this?
Hey! @djorkaeffalexandre I want to contribute to this, but I am a beginner and new to this community, so can you tell me which file to look into and what should be the further steps?. Please guide me.
Hi all! I also have the same bug here. Is there any solution for this! @diegolmello @djorkaeffalexandre
@arpsyapathy Can you share how to reproduce it? I wasn't able to do it. Let me know if you want to help.
I face the same problem. No idea how to reproduce anyways. Several users show as online in the mobile app while they are offline. ( Desktop and web version display the correct status )
But one thing that I noticed is that If I force stop the app, it will update on the next run.
@diegolmello is there anything I can do or logs that I can collect to help debugging this?
If you can record a video, it'd help us. I still can't reproduce it.
Record a video is more complicated for me. I will try help with debug data.
Just to explain my scenario, it maybe related somehow.
I have one haproxy loadbalancing for two nginx ingresses that send the traffic for 4 rocketchat instances ( kubernetes ).
This is the log I get from the desktop client when I start scrolling the contact list after being idle for 5 minutes ( I removed the avatar call )
GET /api/v1/users.presence?ids[]=rocket.cat&ids[]=DepXGwHS3DdbavffY&ids[]=MSf9hnbBPANntdfQL HTTP/1.1
GET /api/v1/users.presence?ids[]=vwPNLeq7iEtsR82s5&ids[]=7BH9seNKqq2x7vquk&ids[]=PReM6Q5DSbXiYNXt4&ids[]=ZWpHsAmy4rssCp9NZ&ids[]=KX8tumpK7aXscYAvn&ids[]=CYRwWBhywDE8Gsd2Q&ids[]=tCDwgE3ZAszD2MMx9&ids[]=bvpfgiMKoXARiCdni&ids[]=vRCJHBwNadyHAXj7u&ids[]=DTzjv3dw7i4xBsPrc&ids[]=A7q8nGquHzxkQoXwm&ids[]=7jC74gdSYirTWBvah&ids[]=zmNSKEcCfeJzEh9ek&ids[]=3afHHKMDA9wEqsRQd&ids[]=e5pjpXqpqwKw2xyXG&ids[]=f9aG4MG5Yo26of5Mw&ids[]=yisppeNCWEciqmtLo HTTP/1.1
GET /api/v1/users.presence?ids[]=G2M4B9M73AgiYm9up&ids[]=TgNgvDRy5us482qZo&ids[]=erEjSzNALMqZ4Pmke&ids[]=E7cMJexZzAj4YbWun&ids[]=uLgr4q4vMYgDGMApf&ids[]=MFTfbDDwL4pZGKuk7&ids[]=jpBctJpvhNybehhaP&ids[]=PjipxJByqbmq7xX52 HTTP/1.1
GET /api/v1/users.presence?ids[]=DTzjv3dw7i4xBsPrc&ids[]=bvpfgiMKoXARiCdni&ids[]=vRCJHBwNadyHAXj7u&ids[]=CYRwWBhywDE8Gsd2Q&ids[]=tCDwgE3ZAszD2MMx9&ids[]=KX8tumpK7aXscYAvn&ids[]=ZWpHsAmy4rssCp9NZ&ids[]=PReM6Q5DSbXiYNXt4&ids[]=vwPNLeq7iEtsR82s5&ids[]=7BH9seNKqq2x7vquk&ids[]=DepXGwHS3DdbavffY&ids[]=MSf9hnbBPANntdfQL&ids[]=rocket.cat HTTP/1.1
GET /api/v1/users.presence?ids[]=zPyaKKp3poyKcsoHY&ids[]=ftTeKZgyEuWowfQTC&ids[]=njxhsmJ8ux45rWCGe&ids[]=M4WTrKExArvrxfuWb&ids[]=rpDBpGN2Gydrc2yQR&ids[]=4u8EYwSiGRJm2uu3X&ids[]=xJXurJ34w9kDzo4Jd&ids[]=54zKiastRCQRtjeah&ids[]=XxGjsFtjf4XAoicqC&ids[]=RDRMrdzNR69G8edY9&ids[]=YayKYijHDabadWRgK&ids[]=99M9rm8pYzjtyjeLa&ids[]=vAhC3vD7K4BBCraEB&ids[]=P462Nt687m68xxAEw&ids[]=k2bKuWBDzcHkDFQ6L&ids[]=MnYmJvpcbQKJaPbxM HTTP/1.1
And this is what I get from the android app:
GET /api/v1/rooms.get?updatedSince=2021-02-02T12%3A07%3A07.310Z HTTP/1.1
GET /api/v1/subscriptions.get?updatedSince=2021-02-02T12%3A07%3A07.310Z HTTP/1.1
GET /api/v1/users.presence?ids=MnYmJvpcbQKJaPbxM%2Ck2bKuWBDzcHkDFQ6L%2CRDRMrdzNR69G8edY9%2CYayKYijHDabadWRgK%2C99M9rm8pYzjtyjeLa%2CvAhC3vD7K4BBCraEB%2CP462Nt687m68xxAEw%2CxJXurJ34w9kDzo4Jd%2C54zKiastRCQRtjeah%2CXxGjsFtjf4XAoicqC%2CM4WTrKExArvrxfuWb%2CrpDBpGN2Gydrc2yQR%2C4u8EYwSiGRJm2uu3X%2CnjxhsmJ8ux45rWCGe%2CftTeKZgyEuWowfQTC%2CzPyaKKp3poyKcsoHY%2Crocket.cat%2CDepXGwHS3DdbavffY%2CMSf9hnbBPANntdfQL%2CvwPNLeq7iEtsR82s5%2C7BH9seNKqq2x7vquk%2CPReM6Q5DSbXiYNXt4 HTTP/1.1
It appears I only have one call for users.presence on android, even after scrolling the whole contact list.
If I force close the app on Android and start it again, I will get several calls to users.presence endpoint and the status will match those on the desktop client.
GET /api/info HTTP/1.1
POST /api/v1/login HTTP/1.1
GET /api/v1/roles.list? HTTP/1.1
GET /api/v1/rooms.get?updatedSince=2021-02-02T12%3A12%3A06.653Z HTTP/1.1
GET /api/v1/users.presence?ids=MnYmJvpcbQKJaPbxM%2Ck2bKuWBDzcHkDFQ6L%2CRDRMrdzNR69G8edY9%2CYayKYijHDabadWRgK%2C99M9rm8pYzjtyjeLa%2CvAhC3vD7K4BBCraEB%2CP462Nt687m68xxAEw%2CxJXurJ34w9kDzo4Jd%2C54zKiastRCQRtjeah%2CXxGjsFtjf4XAoicqC%2CM4WTrKExArvrxfuWb%2CrpDBpGN2Gydrc2yQR%2C4u8EYwSiGRJm2uu3X%2CnjxhsmJ8ux45rWCGe%2CftTeKZgyEuWowfQTC%2CzPyaKKp3poyKcsoHY%2Crocket.cat%2CDepXGwHS3DdbavffY%2CMSf9hnbBPANntdfQL%2CvwPNLeq7iEtsR82s5%2C7BH9seNKqq2x7vquk%2CPReM6Q5DSbXiYNXt4%2CA7q8nGquHzxkQoXwm HTTP/1.1
...
GET /api/v1/users.presence?ids=ZWpHsAmy4rssCp9NZ%2CKX8tumpK7aXscYAvn%2CCYRwWBhywDE8Gsd2Q%2CtCDwgE3ZAszD2MMx9%2CbvpfgiMKoXARiCdni%2CvRCJHBwNadyHAXj7u%2CDTzjv3dw7i4xBsPrc%2CA7q8nGquHzxkQoXwm%2C7jC74gdSYirTWBvah%2CzmNSKEcCfeJzEh9ek%2C3afHHKMDA9wEqsRQd%2Ce5pjpXqpqwKw2xyXG%2Cf9aG4MG5Yo26of5Mw%2CyisppeNCWEciqmtLo HTTP/1.1
GET /api/v1/users.presence?ids=G2M4B9M73AgiYm9up%2CTgNgvDRy5us482qZo%2CerEjSzNALMqZ4Pmke%2CE7cMJexZzAj4YbWun%2CuLgr4q4vMYgDGMApf%2CMFTfbDDwL4pZGKuk7%2CjpBctJpvhNybehhaP%2CPjipxJByqbmq7xX52 HTTP/1.1
@diegolmello Hope that debug helps.
@jsalatiel I see.
So there's an issue when:
- Open app
- Login
- Scroll
- Issue
But after closing the app and being logged in everything works fine?
This issue is old already. Have you tried it on 4.14.0?
Hi Diego, the problem is not related to login. I am already logged in on the app on my android.
The issue is: Open the mobile app after a few minutes. Compare the status with the web or desktop app. Several users will have different status. Most of them remains online or busy on mobile while they are actually offline on desktop/web ui.
When I said close the app, I mean force close ( going in to android info, and choosing force stop ). After reopening , the status will be correctly updated. I can notice that after this "fresh start", all contacts starts with offline icon and one second later they update correctly. So I think that every time the main activity ( contact list ) is resumed (not onActivityCreated or onActivityStarted, but onActivityResumed ) , it should refresh the presence for the users. So this would avoid this issue.
btw, I am already on 4.14.0 and server is 3.8.4
server is 3.8.4
Can you reproduce it on https://open.rocket.chat? We're on 3.11.0 already.
I will try. What's your username there ?
diego.mello
Upgraded my test environment to 3.11. The problem is a lot worse there. Basically all users are locked in Online state by default unless they manually change. They are never offline, unless set to invisible manually.