in v1 there's a neat xt/listen that you can use to make automagically updating things by reacting to new txs, is there something comparable for v2?
for reference from a lightweight portal we did with xt1 back in the day, https://github.com/solita/lipo/blob/main/src/lipo/portlet/comments.clj#L22 you can create an automatically updating source that listens to new transactions and has a customizable "should update?" function that gets the tx data and determines if there is need to rerun the query... very handy, you just define the query and check fn and your UI is always up to date
hey @tatut 👋 not currently, I'm afraid - openly, we haven't had a client/design partner request it yet, so it hasn't yet made it up the order. it's definitely an interesting feature, though, looking forward to implementing it 🙂
The design space here is interesting. (Ab)using the Postgres NOTIFY/LISTEN paradigm is one option - although even CockroachDB https://github.com/cockroachdb/cockroach/issues/41522 - instead they have a whole other CHANGEFEED https://www.cockroachlabs.com/docs/stable/create-changefeed
In the meantime you should be able to get by with a simple polling query, and if that's not fast enough currently (depending on exactly which (meta)data you're polling for) we should be able to make it faster.
Over the HTTP API we could conceivably support SSEs (but we have no plans to extend the HTTP API currently at all - pgwire is the blessed, stable API)
ok, thanks... so polling is the way at the moment
for making a UI that automatically updates by rerunning relevant queries, you'd need a changefeed that at least the ids of the entities that have changed
> you'd need a changefeed that had at least the ids of the entities that have changed It just occurred to me to mention that a slight variation of https://docs.xtdb.com/quickstart/sql-overview#a-delta-of-changes-to-a-table-since-a-given-system-time example in the docs is probably the query you're essentially looking to be able to poll efficiently, e.g.
SELECT _id FROM people FOR SYSTEM_TIME FROM TIMESTAMP '2020-01-01Z' TO NULL