Matrix-doc: /messages does not provide a way of saying that you cannot paginate further

Created on 28 Aug 2019  路  7Comments  路  Source: matrix-org/matrix-doc

We need to define the error code or mechanism to inform the user that they can't back-paginate further via /messages because the server has run out of DAG.

client-server improvement

Most helpful comment

/messages doesn't have a next_batch. I think you mean end, in which case +1

All 7 comments

Do we really need to invent anything here if /messages returns state changes and m.room.create is (supposed to be) still the very first event no matter how you purge messages?

it's not really a spec-bug imho: it's something we need to agree on and spec.

@KitsuneRal: that is one solution, but there are others which would make just as much (or more) sense. It's worth remembering that /messages lets you go both ways so we could do with a solution that works in the other direction too.

err, yes - it should be an improvement not a bug. I wonder which issue I was trying to label as a bug....

According to https://github.com/matrix-org/matrix-doc/pull/1763#discussion_r318864900 @turt2live thinks that the absence of a next_batch token should be specced to mean "you cannot paginate further", which feels very sane to me. Shall we do that (if it's not already?)

/messages doesn't have a next_batch. I think you mean end, in which case +1

Do we really need to invent anything here if /messages returns state changes and m.room.create is (supposed to be) still the very first event no matter how you purge messages?

Yes. The same problem occurs when you specify a to parameter (to fetch missing backlog in a limited /sync response for example), in which case you don't know what the final event is going to be. The only solutions right now are:

  1. Checking whether the amount of results is less than the limit (fragile, will break in 1/Nth of cases)
  2. Continuing to paginate until an empty chunk is produced (seemingly reliable, but requires a pointless extra request)

According to #1763 (comment) @turt2live thinks that the absence of a next_batch token should be specced to mean "you cannot paginate further", which feels very sane to me. Shall we do that (if it's not already?)

That sounds entirely reasonable to me, and would be in line with how pagination is designed in most HTTP APIs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

richvdh picture richvdh  路  24Comments

dbkr picture dbkr  路  9Comments

matrixbot picture matrixbot  路  19Comments

matrixbot picture matrixbot  路  14Comments

stalniy picture stalniy  路  11Comments