You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Let’s say I want to make a lobby that’s distributed across nodes and I don’t want to rely on hydras distributed networking yet. Mostly because I want the state to be external in case server updates occur and I don’t want to manage state handovers like Elixir and libcluster.
So my approach is dynamically started Supervisor that starts another GenServer that works as a lobby. It gets messages that a player has joined/left/sent a message.
The GenServer would then subscribe to a Redis channel.
When a user joins/leaves/sends a message it would publish it to all connected users (graphql subscription) but also to the Redis pubsub and the other gen-server would do the same.
I guess what I’m asking is how can a GenServer hold a Redis subscription? And how can I return a Stream for something like a async-graphql subscription?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Let’s say I want to make a lobby that’s distributed across nodes and I don’t want to rely on hydras distributed networking yet. Mostly because I want the state to be external in case server updates occur and I don’t want to manage state handovers like Elixir and libcluster.
So my approach is dynamically started Supervisor that starts another GenServer that works as a lobby. It gets messages that a player has joined/left/sent a message.
The GenServer would then subscribe to a Redis channel.
When a user joins/leaves/sends a message it would publish it to all connected users (graphql subscription) but also to the Redis pubsub and the other gen-server would do the same.
I guess what I’m asking is how can a GenServer hold a Redis subscription? And how can I return a Stream for something like a async-graphql subscription?
Beta Was this translation helpful? Give feedback.
All reactions