Message should arrive to the Web App

This commit is contained in:
Luis Fernando Molina committed 2021-11-10 12:02:02 +01:00
1 parent 450d3d26df
commit 578f36eceb
10 files changed
+121 -65

No files matched your search

+10
View File
@@ -7,6 +7,8 @@ exports.newDesktopApp = function newDesktopApp() {
p2pNetworkPeers: undefined,
webSocketsClient: undefined,
webSocketsInterface: undefined,
webAppInterface: undefined,
p2pNetworkInterface: undefined,
socialGraph: undefined,
run: run
}
@@ -49,6 +51,14 @@ exports.newDesktopApp = function newDesktopApp() {
}
async function setupServices() {
/*
This is where we will process all the messages comming from our web app.
*/
thisObject.webAppInterface = DK.projects.socialTrading.modules.webAppInterface.newSocialTradingModulesWebAppInterface()
/*
This is where we will process all the events comming from the p2p network.
*/
thisObject.p2pNetworkInterface = DK.projects.socialTrading.modules.p2pNetworkInterface.newSocialTradingModulesP2PNetworkInterface()
/*
This is the Personal Social Graph for the user running this App.
*/
+1 -1
View File
@@ -5,7 +5,7 @@ let UI = {
schemas: { projectSchema: undefined },
environment: undefined,
clientNode: undefined,
running: {}
webApp: undefined
}
let SA = { projects: {} }
+10 -5
View File
@@ -5,6 +5,7 @@ function newWebApp() {
Everything is being coded here until some structure emerges.
*/
let thisObject = {
messageReceived: messageReceived,
initialize: initialize,
finalize: finalize
}
@@ -19,7 +20,7 @@ function newWebApp() {
try {
setupRootObject(UI, 'UI')
setupRootObject(SA, 'SA')
await UI.projects.socialTrading.modules.webSocketsWebClient.initialize()
await UI.projects.socialTrading.modules.webSocketsWebAppClient.initialize()
loadWUserProfileTimeline()
loadWhoToFollow()
setupEventHandlers()
@@ -113,7 +114,7 @@ function newWebApp() {
queryMessage: JSON.stringify(queryMessage)
}
await UI.projects.socialTrading.modules.webSocketsWebClient.sendMessage(
await UI.projects.socialTrading.modules.webSocketsWebAppClient.sendMessage(
JSON.stringify(query)
)
.then(addToContentDiv)
@@ -183,7 +184,7 @@ function newWebApp() {
queryMessage: JSON.stringify(queryMessage)
}
await UI.projects.socialTrading.modules.webSocketsWebClient.sendMessage(
await UI.projects.socialTrading.modules.webSocketsWebAppClient.sendMessage(
JSON.stringify(query)
)
.then(addWhoToFollowTable)
@@ -360,7 +361,7 @@ function newWebApp() {
eventMessage: JSON.stringify(eventMessage)
}
await UI.projects.socialTrading.modules.webSocketsWebClient.sendMessage(
await UI.projects.socialTrading.modules.webSocketsWebAppClient.sendMessage(
JSON.stringify(event)
)
.then(resolve)
@@ -396,7 +397,7 @@ function newWebApp() {
eventMessage: JSON.stringify(eventMessage)
}
await UI.projects.socialTrading.modules.webSocketsWebClient.sendMessage(
await UI.projects.socialTrading.modules.webSocketsWebAppClient.sendMessage(
JSON.stringify(event)
)
.then(resolve)
@@ -409,4 +410,8 @@ function newWebApp() {
}
}
}
function messageReceived(message) {
window.alert(message)
}
}
+2 -2
View File
@@ -98,8 +98,8 @@ function newWebAppLoader() {
if (downloadedCounter === modulesArray.length) {
setTimeout(() => {
UI.running.webApp = newWebApp()
UI.running.webApp.initialize()
UI.webApp = newWebApp()
UI.webApp.initialize()
}, 500)
}