From ce33c03bf8b57ce9fbb62093f2e353f3a26695a6 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 20 Oct 2021 09:25:31 +0200 Subject: [PATCH 1/5] Cleaning --- .../.vscode/Superalgos Network.code-workspace | 14 -------------- Network/.vscode/settings.json | 17 ----------------- 2 files changed, 31 deletions(-) delete mode 100644 Network/.vscode/Superalgos Network.code-workspace delete mode 100644 Network/.vscode/settings.json diff --git a/Network/.vscode/Superalgos Network.code-workspace b/Network/.vscode/Superalgos Network.code-workspace deleted file mode 100644 index 9970dd1eb..000000000 --- a/Network/.vscode/Superalgos Network.code-workspace +++ /dev/null @@ -1,14 +0,0 @@ -{ - "folders": [ - { - "path": "C:\\Superalgos\\Network" - }, - { - "path": "C:\\Superalgos\\Projects\\Network" - }, - { - "path": "C:\\Superalgos\\Projects\\Social-Trading" - } - ], - "settings": {} -} \ No newline at end of file diff --git a/Network/.vscode/settings.json b/Network/.vscode/settings.json deleted file mode 100644 index e94f27f6f..000000000 --- a/Network/.vscode/settings.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "files.exclude": { - "**/Data-Storage": true, - "**/Documentation": true, - "**/Log-Files": true, - "**/node_modules": true, - "**/Deprecated-Code": true - }, - "search.exclude": { - "**/Data-Storage": true, - "**/Documentation": true, - "**/Log-Files": true, - "**/node_modules": true, - "**/Deprecated-Code": true - }, - "search.maintainFileSearchCache": true -} \ No newline at end of file From a7a338bf26d9e17a1ffc9318b9acba4e7a889cb1 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 20 Oct 2021 10:21:14 +0200 Subject: [PATCH 2/5] Network modules with added comments. --- Network/NetwokNode.js | 10 +++++++--- Projects/Network/NT/Modules/WebSocketsInterface.js | 12 +++++++++++- Projects/Social-Trading/NT/Modules/Bootstrap.js | 7 +++++++ .../Social-Trading/NT/Modules/ClientInterface.js | 4 ++++ Projects/Social-Trading/NT/Modules/PeerInterface.js | 13 ++++++++++--- Projects/Social-Trading/NT/Modules/SocialGraph.js | 2 +- Projects/Social-Trading/NT/Modules/Storage.js | 9 +++++++++ 7 files changed, 49 insertions(+), 8 deletions(-) diff --git a/Network/NetwokNode.js b/Network/NetwokNode.js index 3d3b993dc..22a04fbdb 100644 --- a/Network/NetwokNode.js +++ b/Network/NetwokNode.js @@ -10,14 +10,18 @@ exports.newNetworkNode = function newNetworkNode() { async function run() { /* - Let's start the Network Interfaces + Other Network Nodes and Client Apps will communicate with this Network Node via it's Websocket Interface. */ NT.webSocketsInterface = NT.projects.network.modules.webSocketsInterface.newNetworkModulesWebSocketsInterface() NT.webSocketsInterface.initialize() - + /* + The Social Graph Service is the first and for now, the only service this Network Node provides. + */ thisObject.socialGraphService = NT.projects.socialTrading.modules.socialGraph.newNetworkModulesSocialGraph() await thisObject.socialGraphService.initialize() - + /* + The Sotrage deals with persisting the Social Graph. + */ thisObject.storage = NT.projects.socialTrading.modules.storage.newSocialTradingModulesStorage() thisObject.storage.initialize() } diff --git a/Projects/Network/NT/Modules/WebSocketsInterface.js b/Projects/Network/NT/Modules/WebSocketsInterface.js index 1e4c548dc..32d00fd18 100644 --- a/Projects/Network/NT/Modules/WebSocketsInterface.js +++ b/Projects/Network/NT/Modules/WebSocketsInterface.js @@ -1,5 +1,16 @@ exports.newNetworkModulesWebSocketsInterface = function newNetworkModulesWebSocketsInterface() { + /* + This module represents the websockets interface of the Network Node. + A Network Nodes is epected to receive conections request from 2 different types + of entities: + + 1. Other Network Nodes. + 2. Clients / Apps. + + This module deals with those 2 connection types and is the one receiving from + and sending messages to those entities. + */ let thisObject = { networkClients: undefined, networkPeers: undefined, @@ -45,7 +56,6 @@ exports.newNetworkModulesWebSocketsInterface = function newNetworkModulesWebSock socketServer.on('connection', onConnectionOpened) function onConnectionOpened(socket) - /* This function is executed every time a new Websockets connection is stablished. diff --git a/Projects/Social-Trading/NT/Modules/Bootstrap.js b/Projects/Social-Trading/NT/Modules/Bootstrap.js index 303c2791a..d0b5fb2a6 100644 --- a/Projects/Social-Trading/NT/Modules/Bootstrap.js +++ b/Projects/Social-Trading/NT/Modules/Bootstrap.js @@ -3,6 +3,13 @@ exports.newBootstrap = function newBootstrap() { This module helps the Network Node to bootstrap, by loading all the services and data that needs to start operating. + + In particular, a network node operates with all User Profiles loaded in + memory maps. These profiles become part of the system in the form of User Profiles + Plugins at the Governance System, when user submit them. This means + that all these profiles are already at the local disk of the Network Node. + + From there they will be loaded into memory as part of this bootstrapping process. */ let thisObject = { /* Framework Functions */ diff --git a/Projects/Social-Trading/NT/Modules/ClientInterface.js b/Projects/Social-Trading/NT/Modules/ClientInterface.js index cb01af216..b1791258a 100644 --- a/Projects/Social-Trading/NT/Modules/ClientInterface.js +++ b/Projects/Social-Trading/NT/Modules/ClientInterface.js @@ -6,6 +6,10 @@ exports.newSocialTradingModulesClientInterface = function newSocialTradingModule * Send an Event that happened at the Network Client to the Network. * Make a Query to the Network Node for info needed at the Network Client. + + This interface is one layer above the communication protocol interface + where actual messages are received through, like for instance the + websockets interface. */ let thisObject = { messageReceived: messageReceived, diff --git a/Projects/Social-Trading/NT/Modules/PeerInterface.js b/Projects/Social-Trading/NT/Modules/PeerInterface.js index 6cb730381..e25193d5d 100644 --- a/Projects/Social-Trading/NT/Modules/PeerInterface.js +++ b/Projects/Social-Trading/NT/Modules/PeerInterface.js @@ -1,5 +1,12 @@ exports.newSocialTradingModulesPeerInterface = function newSocialTradingModulesPeerInterface() { - + /* + This module represents the Interface the Network Node have + with other Network Nodes connected to it. + + This interface is one layer above the communication protocol interface + where actual messages are received through, like for instance the + websockets interface. + */ let thisObject = { initialize: initialize, finalize: finalize, @@ -17,6 +24,6 @@ exports.newSocialTradingModulesPeerInterface = function newSocialTradingModulesP } function run() { - - } + + } } \ No newline at end of file diff --git a/Projects/Social-Trading/NT/Modules/SocialGraph.js b/Projects/Social-Trading/NT/Modules/SocialGraph.js index 7bf110fd3..2ca0f8f49 100644 --- a/Projects/Social-Trading/NT/Modules/SocialGraph.js +++ b/Projects/Social-Trading/NT/Modules/SocialGraph.js @@ -1,7 +1,7 @@ exports.newNetworkModulesSocialGraph = function newNetworkModulesSocialGraph() { /* This module represents the Social Graph Service that - this deals with the Social Graph this node mantains. + deals with the Social Graph this node mantains. The Social Graph is one of the services the Network Node provides. This service is responsible for mantaining the whole Social Graph diff --git a/Projects/Social-Trading/NT/Modules/Storage.js b/Projects/Social-Trading/NT/Modules/Storage.js index eaab5a677..fa59b092e 100644 --- a/Projects/Social-Trading/NT/Modules/Storage.js +++ b/Projects/Social-Trading/NT/Modules/Storage.js @@ -3,6 +3,15 @@ exports.newSocialTradingModulesStorage = function newSocialTradingModulesStorage This module represents the Network Node Physical Storage. It is used to save the in-memory events and also to load them when the node is starting. + + Each node has a github repository to store its social graph. + That Github repository can be used by any other node to get the history of + events that can build the social graph. + + Each Network Node saves locally all unsaved events, every one minute, + and after saving, pushes the changes to it's Github repo, which + acts as a backup of itself, and also for other new nodes to bootstrap + their own copy of the social graph. */ let thisObject = { initialize: initialize, From 7c078b286f11a72f9cb1cf2feff1c0563dfedaa8 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 20 Oct 2021 10:36:41 +0200 Subject: [PATCH 3/5] Removing Environment for debug --- DesktopRoot.js | 2 +- Environment.js | 5 +++++ EnvironmentForDebug.js | 24 ------------------------ NetworkRoot.js | 2 +- desktop.js | 4 ++-- 5 files changed, 9 insertions(+), 28 deletions(-) delete mode 100644 EnvironmentForDebug.js diff --git a/DesktopRoot.js b/DesktopRoot.js index ee357f8e2..9cb84924a 100644 --- a/DesktopRoot.js +++ b/DesktopRoot.js @@ -22,7 +22,7 @@ exports.newDesktopRoot = function newDesktopRoot() { */ global.SA = {} /* Load Environment Variables */ - let ENVIRONMENT = require('./EnvironmentForDebug.js'); + let ENVIRONMENT = require('./Environment.js'); let ENVIRONMENT_MODULE = ENVIRONMENT.newEnvironment() global.env = ENVIRONMENT_MODULE /* diff --git a/Environment.js b/Environment.js index 4fb8e38cd..fc46543c6 100644 --- a/Environment.js +++ b/Environment.js @@ -11,13 +11,18 @@ exports.newEnvironment = function () { BASE_PATH: basePath, WEB_SERVER_URL: 'localhost', CLIENT_WEB_SOCKETS_INTERFACE_PORT: 18041, + NETWORK_WEB_SOCKETS_INTERFACE_PORT: 18042, + DESKTOP_WEB_SOCKETS_INTERFACE_PORT: 18043, + DESKTOP_WEB_SOCKETS_INTERFACE_HOST: 'localhost', CLIENT_HTTP_INTERFACE_PORT: 34248, + DESKTOP_HTTP_INTERFACE_PORT: 34249, PATH_TO_DATA_STORAGE: path.join(basePath, './Platform/My-Data-Storage'), PATH_TO_PROJECTS: path.join(basePath, './Projects'), PATH_TO_LOG_FILES: path.join(basePath, './Platform/My-Log-Files'), PATH_TO_PROJECTS_REQUIRED: path.join(basePath, './Projects'), PATH_TO_PROJECT_SCHEMA: path.join(basePath, './Projects/ProjectsSchema.json'), PATH_TO_CLIENT: path.join(basePath, './Platform'), + PATH_TO_DESKTOP: './Desktop', PATH_TO_DEFAULT_WORKSPACE: path.join(basePath, './Projects/Foundations/Plugins/Workspaces'), PATH_TO_MY_WORKSPACES: path.join(basePath, './Platform/My-Workspaces'), PATH_TO_FONTS: path.join(basePath, './Platform/WebServer/Fonts') diff --git a/EnvironmentForDebug.js b/EnvironmentForDebug.js deleted file mode 100644 index 5d7671aa7..000000000 --- a/EnvironmentForDebug.js +++ /dev/null @@ -1,24 +0,0 @@ -exports.newEnvironment = function () { - - let thisObject = { - WEB_SERVER_URL: 'localhost', - CLIENT_WEB_SOCKETS_INTERFACE_PORT: 18041, - NETWORK_WEB_SOCKETS_INTERFACE_PORT: 18042, - DESKTOP_WEB_SOCKETS_INTERFACE_PORT: 18043, - DESKTOP_WEB_SOCKETS_INTERFACE_HOST: 'localhost', - CLIENT_HTTP_INTERFACE_PORT: 34248, - DESKTOP_HTTP_INTERFACE_PORT: 34249, - PATH_TO_DATA_STORAGE: './Platform/My-Data-Storage', - PATH_TO_LOG_FILES: './Platform/My-Log-Files', - PATH_TO_PROJECTS: './Projects', - PATH_TO_PROJECTS_REQUIRED: './Projects', - PATH_TO_PROJECT_SCHEMA: './Projects/ProjectsSchema.json', - PATH_TO_CLIENT: './Platform', - PATH_TO_DESKTOP: './Desktop', - PATH_TO_DEFAULT_WORKSPACE: './Projects/Foundations/Plugins/Workspaces', - PATH_TO_MY_WORKSPACES: './Platform/My-Workspaces', - PATH_TO_FONTS: './Platform/WebServer/Fonts' - } - - return thisObject -} \ No newline at end of file diff --git a/NetworkRoot.js b/NetworkRoot.js index d4bbf0c46..dc0327fba 100644 --- a/NetworkRoot.js +++ b/NetworkRoot.js @@ -22,7 +22,7 @@ exports.newNetworkRoot = function newNetworkRoot() { */ global.SA = {} /* Load Environment Variables */ - let ENVIRONMENT = require('./EnvironmentForDebug.js'); + let ENVIRONMENT = require('./Environment.js'); let ENVIRONMENT_MODULE = ENVIRONMENT.newEnvironment() global.env = ENVIRONMENT_MODULE /* diff --git a/desktop.js b/desktop.js index 7354c18f8..37586f795 100644 --- a/desktop.js +++ b/desktop.js @@ -1,11 +1,11 @@ /* -The Superalgos Desktop is one of the 3 clients of the Superalgos Network: +The Superalgos Desktop is one of the 3 clients of the Superalgos P2P Network: * Superalgos Mobile * Superalgos Desktop * Superalgos Server -Users can unse any of these clients for their social trading activities. +Users can use any of these clients for their social trading activities. This module represents the Nodejs command that users have to start the Desktop App.. From fd7f97030484c1d6e961d49fd525e29209f03d7c Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 20 Oct 2021 11:40:01 +0200 Subject: [PATCH 4/5] Refactoring CLIENT PLATFORM --- Desktop/DesktopApp.js | 2 +- Environment.js | 6 +++--- Platform/Client/httpInterface.js | 20 +++++++++---------- Platform/Client/webSocketsInterface.js | 2 +- Platform/PlatformApp.js | 4 ++-- .../Sensor-Bot/Webhooks/CheckWebhook.js | 2 +- .../TS/Task-Modules/EventServerClient.js | 2 +- .../DK/modules/WebSocketsInterface.js | 4 ++-- 8 files changed, 21 insertions(+), 21 deletions(-) diff --git a/Desktop/DesktopApp.js b/Desktop/DesktopApp.js index 77cf0f03d..8f3883460 100644 --- a/Desktop/DesktopApp.js +++ b/Desktop/DesktopApp.js @@ -29,7 +29,7 @@ exports.newDesktopApp = function newDesktopApp() { DK.running.webSocketsInterface = DK.projects.socialTrading.modules.webSocketsInterface.newDesktopModulesWebSocketsInterface() DK.running.webSocketsInterface.initialize() - console.log('Desktop Client Web Sockets Interface ....................................... Listening at port ' + global.env.CLIENT_WEB_SOCKETS_INTERFACE_PORT) + console.log('Desktop Client Web Sockets Interface ....................................... Listening at port ' + global.env.PLATFORM_WEB_SOCKETS_INTERFACE_PORT) DK.running.httpInterface = DK.projects.socialTrading.modules.httpInterface.newDesktopModulesHttpInterface() diff --git a/Environment.js b/Environment.js index fc46543c6..5d7a914af 100644 --- a/Environment.js +++ b/Environment.js @@ -10,18 +10,18 @@ exports.newEnvironment = function () { let thisObject = { BASE_PATH: basePath, WEB_SERVER_URL: 'localhost', - CLIENT_WEB_SOCKETS_INTERFACE_PORT: 18041, + PLATFORM_WEB_SOCKETS_INTERFACE_PORT: 18041, NETWORK_WEB_SOCKETS_INTERFACE_PORT: 18042, DESKTOP_WEB_SOCKETS_INTERFACE_PORT: 18043, DESKTOP_WEB_SOCKETS_INTERFACE_HOST: 'localhost', - CLIENT_HTTP_INTERFACE_PORT: 34248, + PLATFORM_HTTP_INTERFACE_PORT: 34248, DESKTOP_HTTP_INTERFACE_PORT: 34249, PATH_TO_DATA_STORAGE: path.join(basePath, './Platform/My-Data-Storage'), PATH_TO_PROJECTS: path.join(basePath, './Projects'), PATH_TO_LOG_FILES: path.join(basePath, './Platform/My-Log-Files'), PATH_TO_PROJECTS_REQUIRED: path.join(basePath, './Projects'), PATH_TO_PROJECT_SCHEMA: path.join(basePath, './Projects/ProjectsSchema.json'), - PATH_TO_CLIENT: path.join(basePath, './Platform'), + PATH_TO_PLATFORM: path.join(basePath, './Platform'), PATH_TO_DESKTOP: './Desktop', PATH_TO_DEFAULT_WORKSPACE: path.join(basePath, './Projects/Foundations/Plugins/Workspaces'), PATH_TO_MY_WORKSPACES: path.join(basePath, './Platform/My-Workspaces'), diff --git a/Platform/Client/httpInterface.js b/Platform/Client/httpInterface.js index ea5c2a057..637137c32 100644 --- a/Platform/Client/httpInterface.js +++ b/Platform/Client/httpInterface.js @@ -24,7 +24,7 @@ exports.newHttpInterface = function newHttpInterface() { /* We will create an HTTP Server and leave it running forever. */ - SA.nodeModules.http.createServer(onHttpRequest).listen(global.env.CLIENT_HTTP_INTERFACE_PORT) + SA.nodeModules.http.createServer(onHttpRequest).listen(global.env.PLATFORM_HTTP_INTERFACE_PORT) /* Starting the browser now is optional */ if (process.argv.includes("noBrowser")) { //Running Client only with no UI. @@ -33,7 +33,7 @@ exports.newHttpInterface = function newHttpInterface() { if (initialWorkspace.name !== undefined) { queryString = '/?initialWorkspaceName=' + initialWorkspace.name + '&initialWorkspaceProject=' + initialWorkspace.project + '&initialWorkspaceType=' + initialWorkspace.type } - SA.nodeModules.open('http://localhost:' + global.env.CLIENT_HTTP_INTERFACE_PORT + queryString) + SA.nodeModules.open('http://localhost:' + global.env.PLATFORM_HTTP_INTERFACE_PORT + queryString) } } @@ -1311,17 +1311,17 @@ exports.newHttpInterface = function newHttpInterface() { break case 'LegacyPlotter.js': { - SA.projects.foundations.utilities.httpResponses.respondWithFile(global.env.PATH_TO_CLIENT + '/WebServer/LegacyPlotter.js', httpResponse) + SA.projects.foundations.utilities.httpResponses.respondWithFile(global.env.PATH_TO_PLATFORM + '/WebServer/LegacyPlotter.js', httpResponse) } break case 'PlotterPanel.js': { - SA.projects.foundations.utilities.httpResponses.respondWithFile(global.env.PATH_TO_CLIENT + '/WebServer/PlotterPanel.js', httpResponse) + SA.projects.foundations.utilities.httpResponses.respondWithFile(global.env.PATH_TO_PLATFORM + '/WebServer/PlotterPanel.js', httpResponse) } break case 'Images': // This means the Images folder. { - let path = global.env.PATH_TO_CLIENT + '/WebServer/Images/' + requestPath[2] + let path = global.env.PATH_TO_PLATFORM + '/WebServer/Images/' + requestPath[2] if (requestPath[3] !== undefined) { path = path + '/' + requestPath[3] @@ -1403,12 +1403,12 @@ exports.newHttpInterface = function newHttpInterface() { break case 'WebServer': // This means the WebServer folder. { - SA.projects.foundations.utilities.httpResponses.respondWithFile(global.env.PATH_TO_CLIENT + '/WebServer/' + requestPath[2], httpResponse) + SA.projects.foundations.utilities.httpResponses.respondWithFile(global.env.PATH_TO_PLATFORM + '/WebServer/' + requestPath[2], httpResponse) } break case 'externalScripts': // This means the WebServer folder. { - SA.projects.foundations.utilities.httpResponses.respondWithFile(global.env.PATH_TO_CLIENT + '/WebServer/externalScripts/' + requestPath[2], httpResponse) + SA.projects.foundations.utilities.httpResponses.respondWithFile(global.env.PATH_TO_PLATFORM + '/WebServer/externalScripts/' + requestPath[2], httpResponse) } break case 'Plotters': // This means the plotter folder, not to be confused with the Plotters script! @@ -1423,12 +1423,12 @@ exports.newHttpInterface = function newHttpInterface() { break case 'ChartLayers': { - SA.projects.foundations.utilities.httpResponses.respondWithFile(global.env.PATH_TO_CLIENT + '/UI/' + endpointOrFile + '/' + requestPath[2], httpResponse) + SA.projects.foundations.utilities.httpResponses.respondWithFile(global.env.PATH_TO_PLATFORM + '/UI/' + endpointOrFile + '/' + requestPath[2], httpResponse) } break case 'Files': { - SA.projects.foundations.utilities.httpResponses.respondWithFile(global.env.PATH_TO_CLIENT + '/UI/Data-Files/' + requestPath[2], httpResponse) + SA.projects.foundations.utilities.httpResponses.respondWithFile(global.env.PATH_TO_PLATFORM + '/UI/Data-Files/' + requestPath[2], httpResponse) } break case 'Fonts': @@ -1943,7 +1943,7 @@ exports.newHttpInterface = function newHttpInterface() { break default: { - SA.projects.foundations.utilities.httpResponses.respondWithWebFile(httpResponse, endpointOrFile, global.env.PATH_TO_CLIENT) + SA.projects.foundations.utilities.httpResponses.respondWithWebFile(httpResponse, endpointOrFile, global.env.PATH_TO_PLATFORM) } } } catch (err) { diff --git a/Platform/Client/webSocketsInterface.js b/Platform/Client/webSocketsInterface.js index 084bdea76..5797173da 100644 --- a/Platform/Client/webSocketsInterface.js +++ b/Platform/Client/webSocketsInterface.js @@ -9,7 +9,7 @@ const WEB_SOCKET = SA.nodeModules.ws let socketServer - let port = global.env.CLIENT_WEB_SOCKETS_INTERFACE_PORT + let port = global.env.PLATFORM_WEB_SOCKETS_INTERFACE_PORT return thisObject diff --git a/Platform/PlatformApp.js b/Platform/PlatformApp.js index 7ef1f87b1..dffa50d13 100644 --- a/Platform/PlatformApp.js +++ b/Platform/PlatformApp.js @@ -135,11 +135,11 @@ exports.newPlatformApp = function newPlatformApp() { console.log('') WEB_SOCKETS_INTERFACE = WEB_SOCKETS_INTERFACE.newWebSocketsInterface() WEB_SOCKETS_INTERFACE.initialize() - console.log('Web Sockets Interface ....................................... Listening at port ' + global.env.CLIENT_WEB_SOCKETS_INTERFACE_PORT) + console.log('Web Sockets Interface ....................................... Listening at port ' + global.env.PLATFORM_WEB_SOCKETS_INTERFACE_PORT) HTTP_INTERFACE = HTTP_INTERFACE.newHttpInterface() HTTP_INTERFACE.initialize(initialWorkspace) - console.log('Http Interface .............................................. Listening at port ' + global.env.CLIENT_HTTP_INTERFACE_PORT) + console.log('Http Interface .............................................. Listening at port ' + global.env.PLATFORM_HTTP_INTERFACE_PORT) console.log('') console.log("You are running Superalgos Beta 12") diff --git a/Projects/Data-Mining/TS/Bot-Modules/Sensor-Bot/Webhooks/CheckWebhook.js b/Projects/Data-Mining/TS/Bot-Modules/Sensor-Bot/Webhooks/CheckWebhook.js index ff45cd70d..dc7dd94f3 100644 --- a/Projects/Data-Mining/TS/Bot-Modules/Sensor-Bot/Webhooks/CheckWebhook.js +++ b/Projects/Data-Mining/TS/Bot-Modules/Sensor-Bot/Webhooks/CheckWebhook.js @@ -90,7 +90,7 @@ exports.newDataMiningBotModulesCheckWebhook = function (processIndex) { try { let http = SA.nodeModules.http let url = 'http://' + global.env.WEB_SERVER_URL + - ':' + global.env.CLIENT_HTTP_INTERFACE_PORT + + ':' + global.env.PLATFORM_HTTP_INTERFACE_PORT + '/Webhook/Fetch-Messages/' + TS.projects.foundations.globals.taskConstants.TASK_NODE.parentNode.parentNode.parentNode.referenceParent.parentNode.parentNode.config.codeName + "/" + TS.projects.foundations.globals.taskConstants.TASK_NODE.parentNode.parentNode.parentNode.referenceParent.baseAsset.referenceParent.config.codeName + "-" + diff --git a/Projects/Foundations/TS/Task-Modules/EventServerClient.js b/Projects/Foundations/TS/Task-Modules/EventServerClient.js index add819ab3..8d334e98e 100644 --- a/Projects/Foundations/TS/Task-Modules/EventServerClient.js +++ b/Projects/Foundations/TS/Task-Modules/EventServerClient.js @@ -24,7 +24,7 @@ host = 'localhost' } if (port === undefined) { - port = global.env.CLIENT_WEB_SOCKETS_INTERFACE_PORT + port = global.env.PLATFORM_WEB_SOCKETS_INTERFACE_PORT } let messageCounter = 0 diff --git a/Projects/Social-Trading/DK/modules/WebSocketsInterface.js b/Projects/Social-Trading/DK/modules/WebSocketsInterface.js index beb00d6e4..562c5b5e9 100644 --- a/Projects/Social-Trading/DK/modules/WebSocketsInterface.js +++ b/Projects/Social-Trading/DK/modules/WebSocketsInterface.js @@ -45,7 +45,7 @@ exports.newDesktopModulesWebSocketsInterface = function newDesktopModulesWebSock webApp = { socket: socket } - console.log('Desktop Web App Connected to Web Sockets Interface ......................... Connected to port ' + global.env.CLIENT_WEB_SOCKETS_INTERFACE_PORT) + console.log('Desktop Web App Connected to Web Sockets Interface ......................... Connected to port ' + global.env.PLATFORM_WEB_SOCKETS_INTERFACE_PORT) webApp.socket.on('close', onConnectionClosed) webApp.socket.on('message', onMenssage) @@ -92,7 +92,7 @@ exports.newDesktopModulesWebSocketsInterface = function newDesktopModulesWebSock function onConnectionClosed() { webApp = undefined - console.log('Desktop Web App Discoonnected from Web Sockets Interface ................... Disonnected from port ' + global.env.CLIENT_WEB_SOCKETS_INTERFACE_PORT) + console.log('Desktop Web App Discoonnected from Web Sockets Interface ................... Disonnected from port ' + global.env.PLATFORM_WEB_SOCKETS_INTERFACE_PORT) } } catch (err) { From 38b88a589bdcafb063212d3c577d6397fd76d67b Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 20 Oct 2021 12:05:19 +0200 Subject: [PATCH 5/5] Fixing Port Numbers --- Desktop/DesktopApp.js | 10 ++++------ Projects/Social-Trading/DK/modules/SocialGraph.js | 8 +++++++- .../Social-Trading/DK/modules/WebSocketsInterface.js | 4 ++-- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/Desktop/DesktopApp.js b/Desktop/DesktopApp.js index 8f3883460..4235ab1b5 100644 --- a/Desktop/DesktopApp.js +++ b/Desktop/DesktopApp.js @@ -8,16 +8,14 @@ exports.newDesktopApp = function newDesktopApp() { async function run() { /* - Heree we will store our running objects: + Here we will store our running objects: */ DK.running = {} - /* - This is the Web Sockets client that interacts with the Superalgos Network. + This is the Personal Social Graph for the user running this App. */ DK.running.socialGraph = DK.projects.socialTrading.modules.socialGraph.newSocialTradingModulesSocialGraph() await DK.running.socialGraph.initialize() - /* This is the Web Sockets client that interacts with the Superalgos Network. */ @@ -25,11 +23,11 @@ exports.newDesktopApp = function newDesktopApp() { await DK.running.webSocketsClient.initialize() console.log('Desktop Client Connected to Network Node via Web Sockets ................... Connected to port ' + global.env.NETWORK_WEB_SOCKETS_INTERFACE_PORT) - /* These are the Network Interfaces by which the UI interacts with the Desktop App.*/ + /* These are the Network Interfaces by which the Web App interacts with this Desktop Client.*/ DK.running.webSocketsInterface = DK.projects.socialTrading.modules.webSocketsInterface.newDesktopModulesWebSocketsInterface() DK.running.webSocketsInterface.initialize() - console.log('Desktop Client Web Sockets Interface ....................................... Listening at port ' + global.env.PLATFORM_WEB_SOCKETS_INTERFACE_PORT) + console.log('Desktop Client Web Sockets Interface ....................................... Listening at port ' + global.env.DESKTOP_WEB_SOCKETS_INTERFACE_PORT) DK.running.httpInterface = DK.projects.socialTrading.modules.httpInterface.newDesktopModulesHttpInterface() diff --git a/Projects/Social-Trading/DK/modules/SocialGraph.js b/Projects/Social-Trading/DK/modules/SocialGraph.js index 1b67a534a..0d24d40b2 100644 --- a/Projects/Social-Trading/DK/modules/SocialGraph.js +++ b/Projects/Social-Trading/DK/modules/SocialGraph.js @@ -4,8 +4,14 @@ exports.newSocialTradingModulesSocialGraph = function newSocialTradingModulesSoc the user profile of the user of the Desktop App. A personal social graph is very similar to the one mantained at a Netwrok Node, the mainn difference is that it only includes information relevant - to this particular user, and not for al the users in the system + to this particular user, and not for all Superalgos users as in the Network Node. + + Why we need this? + + Because we need to minimize the calls to the network. There might be + information that the web app needs that we already have, so there is + no need to ask it to a network node. */ let thisObject = { initialize: initialize, diff --git a/Projects/Social-Trading/DK/modules/WebSocketsInterface.js b/Projects/Social-Trading/DK/modules/WebSocketsInterface.js index 562c5b5e9..2f739ce9c 100644 --- a/Projects/Social-Trading/DK/modules/WebSocketsInterface.js +++ b/Projects/Social-Trading/DK/modules/WebSocketsInterface.js @@ -45,7 +45,7 @@ exports.newDesktopModulesWebSocketsInterface = function newDesktopModulesWebSock webApp = { socket: socket } - console.log('Desktop Web App Connected to Web Sockets Interface ......................... Connected to port ' + global.env.PLATFORM_WEB_SOCKETS_INTERFACE_PORT) + console.log('Desktop Web App Connected to Web Sockets Interface ......................... Connected to port ' + global.env.DESKTOP_WEB_SOCKETS_INTERFACE_PORT) webApp.socket.on('close', onConnectionClosed) webApp.socket.on('message', onMenssage) @@ -92,7 +92,7 @@ exports.newDesktopModulesWebSocketsInterface = function newDesktopModulesWebSock function onConnectionClosed() { webApp = undefined - console.log('Desktop Web App Discoonnected from Web Sockets Interface ................... Disonnected from port ' + global.env.PLATFORM_WEB_SOCKETS_INTERFACE_PORT) + console.log('Desktop Web App Discoonnected from Web Sockets Interface ................... Disonnected from port ' + global.env.DESKTOP_WEB_SOCKETS_INTERFACE_PORT) } } catch (err) {