code100x / chess

A multiplayer chess platform
https://chess.100xdevs.com/
1.62k stars 584 forks source link

Chore | Singleton implementation for Sockets #354

Closed aadeshkulkarni closed 5 months ago

aadeshkulkarni commented 5 months ago

fixes #355


What is the purpose of this PR ?

Value additon ?

What is the PR about ?

Where ?

  1. SocketManager.ts

    • Instead of exporting the SocketManager class, we now export the singleton instance of class.
    • Instead of checking with this.instance, we now use SocketManager.instance which is the standard way of calling in static. (As explained in Week 21.2)
  2. Game.ts & GameManager.ts

    • Instead of using getInstance like SocketManager.getInstance(), we can now directly use socketManager which points to the singleton instance.
siinghd commented 5 months ago

Looks fine, Thank you for your contribution