tiled icon indicating copy to clipboard operation
tiled copied to clipboard

Implement `start=latest`

Open danielballan opened this issue 2 months ago • 0 comments

Subscribers can ask for:

  • The first update (useful to avoid missing the beginning due to a "race") start=1
  • The oldest update available start=0
  • An arbitrary update (useful for resuming after disconnection) start=N
  • The next update (default)

Missing here is the ability to ask for the just the most recent update before receiving live events. Incidentally, this is the behavior of EPICS. It's useful for initializing a display with the current value immediately upon connection, which is important if the next update might not be coming for a while.

It should be fairly easy to implement this: check the current value of the counter N and then do what we would have done if the user had explicitly requested start=N.

I propose to implement this as the query parameter start=latest. This would introduce string (enum) values into what thus far has been an integer only field. And if we do that, we might additionally accept start=next a way to explicitly request the current default behavior. We could also consider whether there is a good use to use for "oldest available" in place of start=0, which is admittedly a little cryptic. (I got the idea for Bluesky Social's API, so it's not unheard of but it would be fair to criticize it as not obvious.)

danielballan avatar Oct 24 '25 13:10 danielballan