Hey guys, I was looking into rethinkdb because I would like to design a reactive database on the server for a multiplayer game I am designing. My thought was to do this in a similar way to re-frame’s subscriptions where a player will connect to the server and subscribe to game data they need (eg character stats, skills etc) and then those will automatically be resent to the client when they change server side.
I am a little fuzzy how/if I can achieve this. I see in the clojure wrapper there is a core.async functionality but would that mean that every client that connects and every query they make will create a thread? Would that be limiting?
@kasuko I think core.async uses a shared thread pool.
Alright, I will look into that. Though does that mean that I may run into queries blocking other queries?
Maybe. Although if that happens.. well that’s a good problem to have 🙂
I was worried about say 8 players creating a query for there skills which only change slowly. Then a 9th player subscribing to their stats (like HP) which may change often. But since the first 8 players are using the threads to wait for their skills to change they block the 9th player from seeing their HP update. However it looks like if I stick to go blocks that makes a IOC thread which parks the thread if it’s waiting for a message and that means that 8 queries that have actually returned something can run at a time, and since a query returning would most likely just result in a message down a websocket I think I’ll be okay