Global overview - project-SIMPLE/simple.webplatform GitHub Wiki
Global overview
Internet ports
- Application port is the HTTP web interface of the server. If you change this port, you have to go the the webpage localhost:app_port/.
- Monitor websocket port can be changed freely without any consequences for the use. I gave the possibility to change it if there is a concurrency.
- GAMA Server websocket port must be the same as the port used by Gama Server. You will be able to see which one in used in the setting page of GAMA.
- Player websocket port is the port where player will connect.
[!NOTE] All of these ports are editable in
settings.json
or in the settings webpage.
Code explaination
This program comprises several classes that are instantiated only once. When the program is launched, index.js is executed and creates a Controller instance described in controller.js. It is this controller that will instantiate all the other components, which are each of the classes.
- Controller: Main class of the project. It is instanciated by
index.js
and launches every following components (it instanciates one object of each classes). It also spreads internal communications of each components using interface methods. - Model: It contains all the global variables of the program. The status of Gama Server, of the Players and the settings variables.
- Gama Connector: this class opens a websocket client and handle connection with Gama Server. It handles reception and sending of messages to it.
- Player Server: this class creates a websocket server that manage players connetions
- Monitor Server: this class opens a websocket server and sends all the information that is displayed on the monitor webpage. It also handles intructions given by the monitor webpage.
- App Server: this class creates an HTTP server that sends to clients all the webpage needed. It is mainly the monitor webpage but it cas also be player webpage if needed.
[!TIP] To go further with websocket clients (to understand
gama_connector.js
), see MDN Doc for ws clientsTo go further with websocket server (to understand
player_server.js
andmonitor_server.js
), see MDN Doc for ws server
Here you can see a pseudo-UML diagram explaining more specifically the structure of the code.