-
-
Notifications
You must be signed in to change notification settings - Fork 361
Update presence status when the window loses focus. #2395
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
(cherry picked from commit 9c99a84) Signed-off-by: Kris Hu <[email protected]>
|
All contributors have signed the CLA ✍️ ✅ |
|
I have read the CLA Document and I hereby sign the CLA |
ajbura
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, Thanks. The changes mostly look good, but i could not able to test them as my server doesn't have presence feature enabled. Could you recommend any server which does that and have open registration?
Also it might be a good idea to only setSyncPresence if server actually support it.
|
Preview: https://2395--pr-cinny.netlify.app |
Thanks for responding, I am new to the Matrix Ecosystem and not familiar with it, so please do point it out if I am wrong. I personally use Synapse as my HS. Which, if I recollect correctly, is also the HS for matrix.org. As it for reproducing, my guess is that you are using Cinny as your client, which does not display presence of users. You can try Element. But the easiest way is to run a curl command in shell: curl -X GET https://<YOUR_HOMESERVER>/_matrix/client/v3/presence/<ANY_USER_YOU_LIKE>/status \
--header 'Authorization: Bearer <YOUR_ACCESS_TOKEN>'Access token can be get in Cinny's Settings > Developer Tools. Enable Developer Tools first, and copy Access Token. This API is documented in Matrix Client-Server API spec. Here I also quote from Matrix spec:
Where Presence defined as a module, most popular matrix server should implemented this module, i.e., Cinny should properly handle presence status accordingly. Setting presence status along with a |
|
yeah synapse do support presence but |
(cherry picked from commit 9c99a84)
Description
Background: My friends complained that I always show online but don’t read messages in time and confused. I discovered that Cinny keeps setting my account’s presence status to
onlineeven when I put the client in the background.Apparently, Cinny sent
/syncrequests to Homeserver even in the background, which is reasonable for a client to catch up with events. However, this misled the HS to believe that the user wasonline.Investigating Matrix Client-Server API specification, I discovered that an user's presence status is inferred by Homeserver based on API activities or be explicitly set by Client via
/presence/{userId}/statusor implicitly set along with/syncrequests using parameterset_presence.matrix-js-sdkprovides both methodssetPresenceandsetSyncPresence.Ideally, we choose to use
setSyncPresence. Because even if presence status were set via/presence,/syncAPI calls that keep running in the background still confuse Homeserver to consider the user beingonline. Furthermore, this way won't override possible presence status from other clients.After this change, a) when the Cinny window is focused, the presence is
online, b) when the Cinny window is not focused and running in background, the presence isunavailable, c) when the Cinny isn't running, the presence isoffline.Type of change
Checklist: