We would like to have a subset of users where the user presence is manually controlled, we can see there is an API but we need to know that this overrides any automated systems, is this possible and how do you achieve it?
There isn't a specific API for managing user presence. It's just the user API, as a user's overall site presence is a property on the user's entity called Presence. While that property can be set, it will be overriden as the user uses or navigates away from the site.
However, there is also the EnablePresenceTracking property of a user (exposed in the UI via a user's Settings > Enable Presence Tracking, and also editable via REST) which can be updated to prevent the user's presence indicator from rendering.
It's also potentially worth noting that these are separate from Content/Service presence, which are continuously mapped and updated against logged in users in order to support real time messaging (such as live forum threads). Those have their own API endpoints and can also be updated via REST.
So if we disabled Presence Tracking could we manually write a plugin to control it, or would the presence not display anywhere on the site?
If presence tracking is disabled, it is not shown on the site.
Ideas gratefully received
Could you give more detail regarding the use-case?
let's say for general users we want presence to work normally
however for a subset of special users we want to give them the ability to be able to manually control their presence. So they can stay online or offline regardless of if they have a session open in the browser.
Unfortunately, that would be difficult to achieve currently, as user presence is specifically cleaned up through multiple cascading approaches to ensure that presence status is accurate.
In more detail, a user is set to offline several seconds after a socket connection has been closed (and not re-opened) due to navigating away from the site. And failing that (a badly-behaved browser or broken connection), a scheduled job sets the user to offline several minutes after the user is not known to be present to any content (not viewing any content on the site).
If the goal is to simply show an indicator for certain users with a specific presence state regardless of actual underlying presence, that could be achieved by overriding the userpresence UI component to render a specific indicator for specific users.
ok thanks let me think on it
As another potential solution:
The existence (or lack thereof) of content presence records is what governs a user's overall site presence. That is, when content presence mappings are created/updated or removed, if there is at least 1 mapping, the user's overall site presence is set to online. If there are not, then the user is scheduled to be set offline after a momentary grace period for intermittent disconnects or page navigations.
So, you could have a job or some other process that frequently updates a content presence record for a user (say, every 15 seconds). There is a REST endpoint for creating/removing these. community.telligent.com/.../content-presence-rest-endpoints
ah that's interesting, that works for the positive side but not the negative, ie when they want to look offline but are actually there.
Powered by Telligent Community