<@U02AB5P2XU6> I’m messing around with your chat d...
# kobweb
a
@David Herman I’m messing around with your chat demo. Really fun stuff. How hard would it be to adapt that to have a persistent backend? I saw your ApiStream object. Is that something that could run through a server as the intermediary? Absolutely no rush to respond… just messing around for fun and was curious.
d
Great question. It's easier for API routes, because you just delegate your data to a database. API streams are more annoying because they are scoped to the single running web server you happened to connect to. To create something more robust and consistent, you need to use some pubsub service to replace them, which might not be a direct code migration.
👍 1
a
That’s really interesting. So essentially if you have any sort of load balancing… things get complicated quickly? I wonder if something like GraphQL’s subscription system could be used… where maybe it works only as a pub sub event system alerting the front end that data has changed and to call a query.
d
Note that ApiStreams are great for frontend <-> backend syncing. The only trick is if you have many backends spin up and you want people to still be able to chat with each other. At that point, you could use a pubsub system entirely on the backend and the frontend shouldn't be any wiser.
👍 1
You'll see in the chat example I use the broadcast function. That's basically what doesn't scale.
👍 1
It would be great if you were making one of those silly game websites where, say, you join and you're an organism of some small size, and other people have joined as well, and you're all trying to avoid each other, eat food to grow, and then eat each other.
👍 1