Since the original branch was very out-of-date, here's a new branch with the same initial changes but with some refactoring on top of that:
Cleaned up the Socket object. The main difference is that it uses an EventEmitter to signal events (open, close, and message), rather than overriding existing functions.
The gameplay/chat specialisations have been removed in favour of event callbacks. This means we also no longer have that circular dependency problem!
The Socket instances for the chat and gameplay are now managed by the game and DiscordManager modules.
Cleaned up DiscordManager, mainly regarding private variables and the db parameter.
The user auth check is now part of the chat socket logic, rather than the gameplay one.
Added init/stop function for game to make the relevant code a bit cleaner, though game still needs work as a whole.
Since the original branch was very out-of-date, here's a new branch with the same initial changes but with some refactoring on top of that:
Socket
object. The main difference is that it uses anEventEmitter
to signal events (open
,close
, andmessage
), rather than overriding existing functions.gameplay/chat
specialisations have been removed in favour of event callbacks. This means we also no longer have that circular dependency problem!Socket
instances for the chat and gameplay are now managed by thegame
andDiscordManager
modules.DiscordManager
, mainly regarding private variables and thedb
parameter.game
to make the relevant code a bit cleaner, thoughgame
still needs work as a whole.Referencing issues Closes #200