Closed powelli13 closed 2 years ago
These are all awesome questions! Here's my take on things:
Phoenix.PubSub
is a child of the GameServer
application supervision tree not GameServerWeb
. So when your GenServers
publish to it, nothing is crossing the application boundary. You should check out Sasa Juric's blog post series about this topic and his library Boundary:via
tuple. Its a nice trick to directly interface with the GenServer
API (or other OTP friends that take the :name
option) when you're using Registry
.@nickdichev thanks for the feedback and suggestions! I really appreciate it.
This issue will act to save areas that I'd like feedback on from Code Reviews.
The
GameServer
app usesGenServer
s to maintain the state for each kind of game, theseGenServer
s have separate modules for theDynamicSupervisor
s. In an Elixir app should individual specifically modulesGameServer.GameSupervisor
andGameServer.TttGameSupervisor
be specified as theDynamicSupervisor
for differentGenServer
s or should one supervisor module be used for all the similarGenServer
s?Is it bad form to have two separate Elixir apps both calling into each other? For example in
GameServerWeb
the Phoenix channel modules lookup the Player Queues via the Registry to add players, and then theGenServer
s in theGameServer
app use Phoenix PubSub to broadcast game state updates to the Phoenix channels which subsequently push them to the client. Should this all be in one web app rather than an umbrella with two apps?Is there a standard convention for the terms that are sent to
handle_info
implementations? For example inGameServerWeb.TttGameChannel
I usehandle_info
to receive broadcasted game updates from theGenServer
s that hold game state. I simply use tuples with atoms as the first element to define what type of update it is. Is this acceptable should another form be used?The various game channels, example
ttt_game_channel.ex
, useRegistry.lookup
to locate processes for games. Is this the recommended way considering that all the processes are on the same BEAM node?Any feedback on these questions or any other aspects of the Elixir codebase is very much appreciated, thank you!