Open GeoffreyBooth opened 5 years ago
So the query handler is also an event emitter. So you can just pipe that into a websocket stream or something and get events to the client. It even allows backpressure, so if client cannot consume so fast events, it will slowdown.
But personally I have not explored this direction more because I am not completely satisfied with this package. It is reruning queries and while that works, I would like something better.
But personally I have not explored this direction more because I am not completely satisfied with this package. It is rerunning queries and while that works, i would like something better.
Well, do you still think this is better than the competitors you cited on the README? I understand that there could be something better still, but is this the current state of the art for achieving reactive Postgres?
If so, then make an issue describing the improvement you want, and that can be a future enhancement (or rewrite). And there’s still value in a demo showing how this works, as there’s no reason I wouldn’t want to use this rather than the alternatives.
Keep in mind, “rerunning queries” is not so terrible. That’s already what happens in a traditional REST request/response model, or in a polling-based realtime implementation. Aside from Mongo oplog tailing, where else do we avoid rerunning queries? The Redis oplog tailing and and MySQL binlog tailing? Do either of those have generic (non-Meteor) libraries like this one?
Sorry to be unclear. I think this package is good as-is. I am already tracking potential improvements to it in this issue, but as you write yourself, those are not blocking and you can already use this package.
What I meant to write above is that to me personally the interesting thing to work on is to make this reactivity work well. So I am focusing my time on that, and not on writing examples, like how to push the data to the client and demonstrate the full stack here. So just my priorities are different.
If somebody wants to contribute an example, that would be great and I can help with it a bit if you get stuck.
I added a label to make it explicit that I would welcome a full-stack example, if somebody wants to make it and contribute it.
The README has great examples of having the server run callbacks in response to database changes; is there an example you could include or link to that would show how to update the client from such a callback? I understand that that would necessarily include other libraries, such as to handle a websocket connection; so maybe it could be a separate repo, or subfolder in this one.
I think showing the reactivity working end-to-end in a simple hello-world-style app would be a powerful demo, and would help explain how this library can be used.