Interface SyncApi


  • @Path("/_matrix/client/r0")
    @Consumes("application/json")
    @Produces("application/json")
    public interface SyncApi
    To read events, the intended flow of operation is for clients to first call the /sync API without a since parameter. This returns the most recent message events for each room, as well as the state of the room at the start of the returned timeline. The response also includes a next_batch field, which should be used as the value of the since parameter in the next call to /sync. Finally, the response includes, for each room, a prev_batch field, which can be passed as a start parameter to the /rooms/<room_id>/messages API to retrieve earlier messages.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Interface Description
      static class  SyncApi.Presence
      PresenceContent.
    • Method Summary

      Modifier and Type Method Description
      void events​(String from, Long timeout, String roomId, 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 will listen for new events related to a particular room and return them to the caller.
      void sync​(String filter, String since, Boolean fullState, String setPresence, Long timeout, javax.ws.rs.core.UriInfo uriInfo, javax.ws.rs.core.HttpHeaders httpHeaders, javax.ws.rs.container.AsyncResponse asyncResponse, javax.ws.rs.core.SecurityContext securityContext)
      Synchronise the client's state with the latest state on the server.
    • Method Detail

      • sync

        @GET
        @Path("/sync")
        void sync​(@QueryParam("filter")
                  String filter,
                  @QueryParam("since")
                  String since,
                  @QueryParam("full_state")
                  Boolean fullState,
                  @QueryParam("set_presence")
                  String setPresence,
                  @QueryParam("timeout")
                  Long timeout,
                  @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)
        Synchronise the client's state with the latest state on the server. Clients use this API when they first log in to get an initial snapshot of the state on the server, and then continue to call this API to get incremental deltas to the state, and to receive new messages.
        Requires auth: Yes.
        Return: SyncResponse.

        Status code 200: The initial snapshot or delta for the client to use to update their state.

        Parameters:
        filter - The ID of a filter created using the filter API or a filter JSON object encoded as a string. The server will detect whether it is an ID or a JSON object by whether the first character is a "{" open brace. Passing the JSON inline is best suited to one off requests. Creating a filter using the filter API is recommended for clients that reuse the same filter multiple times, for example in long poll requests.
        since - A point in time to continue a sync from.
        fullState - Controls whether to include the full state for all rooms the user is a member of.
        If this is set to true, then all state events will be returned, even if since is non-empty. The timeline will still be limited by the since parameter. In this case, the timeout parameter will be ignored and the query will return immediately, possibly with an empty timeline.
        If false, and since is non-empty, only state which has changed since the point indicated by since will be returned.
        By default, this is false.
        setPresence - Controls whether the client is automatically marked as online by polling this API. If this parameter is omitted then the client is automatically marked as online when it uses this API. Otherwise if the parameter is set to "offline" then the client is not marked as being online when it uses this API. One of: ["offline"]
        timeout - The maximum time to wait, in milliseconds, before returning this request. If no events (or other data) become available before this time elapses, the server will return a response with empty fields.
        By default, this is 0, so the server will return immediately even if the response is empty.
        uriInfo - Request Information.
        httpHeaders - Http headers.
        asyncResponse - Asynchronous response.
        securityContext - Security context.
      • events

        @GET
        @Path("/events")
        void events​(@QueryParam("from")
                    String from,
                    @QueryParam("timeout")
                    Long timeout,
                    @QueryParam("room_id")
                    String roomId,
                    @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 will listen for new events related to a particular room and return them to the caller. This will block until an event is received, or until the timeout is reached.
        This API is the same as the normal /events endpoint, but can be called by users who have not joined the room.
        Note that the normal /events endpoint has been deprecated. This API will also be deprecated at some point, but its replacement is not yet known.
        Requires auth: Yes.
        Return: Page of the Events.

        Status code 200: The events received, which may be none.

        Status code 400: Bad pagination from parameter.

        Parameters:
        from - The token to stream from. This token is either from a previous request to this API or from the initial sync API.
        timeout - The maximum time in milliseconds to wait for an event.
        roomId - The room ID for which events should be returned.
        uriInfo - Request Information.
        httpHeaders - Http headers.
        asyncResponse - Asynchronous response.
        securityContext - Security context.