72 points · by sea-gold · 1y ago · 36 comments
For example, what inspired this over a typical paginated API that lets you sort old to new with an afterId parameter?
If instead the client paginated by lastEventTimestamp, then a server that for any reason no longer had a particular event UUID could at least start at the following one.
I also think using UUID alone isn't the best way to make the ID number. If events only come from one source, then just using autoincrementing will work (like NNTP does for article numbers within a group); being able to request by time might also work (which is also something that NNTP does).
What is the intention there though. Is this for social media type feeds, or is this meant for synchronising data (at the extreme for DB replication for example!).
What if anything is expected of the producer in terms of how long to store events?
I believe cloud events are most common in Kafka-adjacent or event-driven architectures but I think they're used in some GCP serverless things, too
Yep, any opportunity to not reinvent stuff is a big win.
But I'm wary of layers upon layers. I'm thinking of how this could be combined with MQTT... it doesn't seem totally redundant.
Cursors are actually better because you can put any kind of sort order in there. This "lastEventId" seems to be strictly chronological.
Use HTTP server-sent events instead. Those can keep the connection open so you don't have to poll to get real-time updates and they will also let you resume from the last entry you saw previously.
https://developer.mozilla.org/en-US/docs/Web/API/Server-sent...
I would also rather not have a handful of long-polling loops pollute the network tab.
With SSE the server has to be stateful, for load balancing to work you need to be able to migrate connections between servers. Some proxies / load balancers don’t like long lasting connections and will tear them down if there has been no traffic so your need to constantly send a heart beat.
I have deployed SSE, I love the technology, I wouldn’t deploy it if I don’t control the end devices and everything in between, I would just do long polling.
SSE works with normal load balancing the same as regular request/response. It's only stateful if you make your server stateful.
(Details in the previous thread on HTTP Feeds: https://news.ycombinator.com/item?id=30908492 )
If you have to use H1 for some reason you can easily prune connections with the browser visibility api.