Interface PresenceApi
-
@Path("/_matrix/client/r0/presence") @Consumes("application/json") @Produces("application/json") public interface PresenceApi
Each user has the concept of presence information. This encodes:- Whether the user is currently online
- How recently the user was last active (as seen by the server)
- Whether a given client considers the user to be currently idle
- Arbitrary information about the user's current status (e.g. "in a meeting").
This information is collated from both per-device (online, idle, last_active) and per-user (status) data, aggregated by the user's homeserver and transmitted as an m.presence event. This is one of the few events which are sent outside the context of a room. PresenceContent events are sent to all users who subscribe to this user's presence through a presence list or by sharing membership of a room.
A presence list is a list of user IDs whose presence the user wants to follow. To be added to this list, the user being added must be invited by the list owner who must accept the invitation.
User's presence state is represented by the presence key, which is an enum of one of the following:- online : The default state when the user is connected to an event stream.
- unavailable : The user is not reachable at this time e.g. they are idle.
- offline : The user is not connected to an event stream or is explicitly suppressing their profile information from being sent.
-
-
Method Summary
Modifier and Type Method Description void
getPresenceStatus(String userId, javax.ws.rs.core.UriInfo uriInfo, javax.ws.rs.core.HttpHeaders httpHeaders, javax.ws.rs.container.AsyncResponse asyncResponse)
Get the given user's presence state.void
setPresenceStatus(String userId, PresenceRequest request, javax.ws.rs.core.UriInfo uriInfo, javax.ws.rs.core.HttpHeaders httpHeaders, javax.ws.rs.container.AsyncResponse asyncResponse, javax.ws.rs.core.SecurityContext securityContext)
This API sets the given user's presence state.
-
-
-
Method Detail
-
setPresenceStatus
@PUT @Path("/{userId}/status") void setPresenceStatus(@PathParam("userId") String userId, PresenceRequest request, @Context javax.ws.rs.core.UriInfo uriInfo, @Context javax.ws.rs.core.HttpHeaders httpHeaders, @Suspended javax.ws.rs.container.AsyncResponse asyncResponse, @Context javax.ws.rs.core.SecurityContext securityContext)
This API sets the given user's presence state. When setting the status, the activity time is updated to reflect that activity; the client does not need to specify the last_active_ago field. You cannot set the presence state of another user.
Rate-limited: Yes.
Requires auth: Yes.
Return:EmptyResponse
.Status code 200: The new presence state was set.
Status code 429: This request was rate-limited.
- Parameters:
userId
- Required. The user whose presence state to update.request
- JSON body request.uriInfo
- Request Information.httpHeaders
- Http headers.asyncResponse
- Asynchronous response.securityContext
- Security context.
-
getPresenceStatus
@GET @Path("/{userId}/status") void getPresenceStatus(@PathParam("userId") String userId, @Context javax.ws.rs.core.UriInfo uriInfo, @Context javax.ws.rs.core.HttpHeaders httpHeaders, @Suspended javax.ws.rs.container.AsyncResponse asyncResponse)
Get the given user's presence state.
Requires auth: Yes. Return:PresenceStatus
.Status code 200: The presence state for this user.
Status code 403: You are not allowed to see this user's presence status.
Status code 404: There is no presence state for this user. This user may not exist or isn't exposing presence information to you.
- Parameters:
userId
- Required. The user whose presence state to get.uriInfo
- Request Information.httpHeaders
- Http headers.asyncResponse
- Asynchronous response.
-
-