Pub sub with NATS
gedw99 opened this issue · comments
I use nats with htmx.
fir could too .
then all endpoints are virtualised and so are the handlers.
nats can be embedded also, so can make it easier for deployment
https://github.com/livefir/fir/blob/main/pubsub/pubsub.go#L37 looks like we can add nats since you have the adpater pattern
Kine uses nats: https://github.com/k3s-io/kine
for nats: https://github.com/k3s-io/kine/blob/master/examples/nats.md
DO these semantics line up with what you need ?
- Optimized get, put, create, and update commands
- create expects the key to not exist (or was previously deleted)
- update requires a version number used for OCC against the key
- Historical and versioned values per key
- Subscription of changes for the entire KV store a subset of keys
As you can see we can run NATS embedded OR call it externally as a cluster or not.
Unsure how NATS fits into Fir. I ran some benchmarks and the combination of Redis + Websocket is good enough for now. Will revisit this when scale becomes a problem.