Desktop Web App connecting to host and webSocketPort from Client Node

This commit is contained in:
Luis Fernando Molina committed 2021-11-08 17:59:41 +01:00
1 parent aada1165d1
commit 450d3d26df
4 files changed
+16 -1

No files matched your search

+1
View File
@@ -4,6 +4,7 @@ let UI = {
projects: {},
schemas: { projectSchema: undefined },
environment: undefined,
clientNode: undefined,
running: {}
}
+9
View File
@@ -22,6 +22,15 @@ function loadSuperalgos() {
function onResponse(err, file) {
UI.environment = JSON.parse(file)
setupClientNode()
}
}
function setupClientNode() {
httpRequest(undefined, 'ClientNode', onResponse)
function onResponse(err, file) {
UI.clientNode = JSON.parse(file)
setupProjectsSchema()
}
}
@@ -40,6 +40,11 @@ exports.newDesktopModulesHttpInterface = function newDesktopModulesHttpInterface
SA.projects.foundations.utilities.httpResponses.respondWithContent(JSON.stringify(global.env), httpResponse)
}
break
case 'ClientNode':
{
SA.projects.foundations.utilities.httpResponses.respondWithContent(JSON.stringify(DK.desktopApp.p2pNetworkClient.node), httpResponse)
}
break
case 'ProjectsSchema':
{
let path = global.env.PATH_TO_PROJECTS + '/' + 'ProjectsSchema.json'
@@ -24,7 +24,7 @@ function newSocialTradingModulesWebSocketsWebClient() {
async function initialize() {
socketClient = new WebSocket('ws://' + UI.environment.DESKTOP_WEB_SOCKETS_INTERFACE_HOST + ':' + UI.environment.DESKTOP_WEB_SOCKETS_INTERFACE_PORT)
socketClient = new WebSocket('ws://' + JSON.parse(UI.clientNode.config).host + ':' + JSON.parse(UI.clientNode.config).webSocketsPort)
await setUpWebsocketClient()
}