Ready to request profiles
This commit is contained in:
1 parent
a9cf324199
commit
303c8a9920
9 files changed
+86
-76
No files matched your search
+17
-11
@@ -8,25 +8,31 @@ exports.newDesktopApp = function newDesktopApp() {
|
||||
|
||||
async function run() {
|
||||
/*
|
||||
let socialGraphService = NT.projects.network.modules.socialGraph.newSocialGraph()
|
||||
await socialGraphService.initialize()
|
||||
Heree we will store our running objects:
|
||||
*/
|
||||
DK.running = {}
|
||||
|
||||
/*
|
||||
This is the Web Sockets client that interacts with the Superalgos Network.
|
||||
*/
|
||||
DK.webSocketsClient = SA.projects.network.modules.webSocketsClient.newNetworkModulesWebSocketsClient()
|
||||
await DK.webSocketsClient.initialize()
|
||||
DK.running.socialGraph = DK.projects.socialTrading.modules.socialTrading.newSocialTradingModulesSocialGraph()
|
||||
await DK.running.socialGraph.initialize()
|
||||
|
||||
/*
|
||||
This is the Web Sockets client that interacts with the Superalgos Network.
|
||||
*/
|
||||
DK.running.webSocketsClient = SA.projects.network.modules.webSocketsClient.newNetworkModulesWebSocketsClient()
|
||||
await DK.running.webSocketsClient.initialize()
|
||||
|
||||
/* These are the Network Interfaces by which the UI interacts with the Desktop App.*/
|
||||
|
||||
WEB_SOCKETS_INTERFACE = DK.projects.socialTrading.modules.webSocketsInterface.newDesktopModulesWebSocketsInterface()
|
||||
WEB_SOCKETS_INTERFACE.initialize()
|
||||
console.log('Web Sockets Interface ....................................... Listening at port ' + global.env.CLIENT_WEB_SOCKETS_INTERFACE_PORT)
|
||||
|
||||
|
||||
HTTP_INTERFACE = DK.projects.socialTrading.modules.httpInterface.newDesktopModulesHttpInterface()
|
||||
HTTP_INTERFACE.initialize()
|
||||
DK.running.webSocketsInterface = DK.projects.socialTrading.modules.webSocketsInterface.newDesktopModulesWebSocketsInterface()
|
||||
DK.running.webSocketsInterface.initialize()
|
||||
console.log('Web Sockets Interface ....................................... Listening at port ' + global.env.CLIENT_WEB_SOCKETS_INTERFACE_PORT)
|
||||
|
||||
|
||||
DK.running.httpInterface = DK.projects.socialTrading.modules.httpInterface.newDesktopModulesHttpInterface()
|
||||
DK.running.httpInterface.initialize()
|
||||
console.log('Http Interface .............................................. Listening at port ' + global.env.DESKTOP_HTTP_INTERFACE_PORT)
|
||||
|
||||
return
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
let webApp
|
||||
let PROJECTS_SCHEMA
|
||||
let ENVIRONMENT
|
||||
|
||||
/* New Root object*/
|
||||
let UI = {
|
||||
|
||||
+5
-50
@@ -14,7 +14,8 @@ function newWebApp() {
|
||||
function initialize() {
|
||||
try {
|
||||
setupRootObject()
|
||||
//setupHomePage()
|
||||
UI.projects.socialTrading.modules.webSocketsClient.initialize()
|
||||
setupHomePage()
|
||||
} catch (err) {
|
||||
console.log('[ERROR] initialize -> err.stack = ' + err.stack)
|
||||
}
|
||||
@@ -85,7 +86,7 @@ function newWebApp() {
|
||||
queryMessage: JSON.stringify(queryMessage)
|
||||
}
|
||||
|
||||
await DK.webSocketsClient.sendMessage(
|
||||
await UI.projects.socialTrading.modules.webSocketsClient.sendMessage(
|
||||
JSON.stringify(query)
|
||||
)
|
||||
.then(showProfiles)
|
||||
@@ -97,56 +98,10 @@ function newWebApp() {
|
||||
for (let i = 0; i < profiles.length; i++) {
|
||||
let profile = profiles[i]
|
||||
|
||||
/*
|
||||
Test Following Profiles.
|
||||
*/
|
||||
let eventMessage = {
|
||||
eventId: SA.projects.foundations.utilities.miscellaneousFunctions.genereteUniqueId(),
|
||||
eventType: SA.projects.socialTrading.globals.eventTypes.FOLLOW_USER_PROFILE,
|
||||
emitterUserProfileId: DK.TEST_NETWORK_CLIENT_USER_PROFILE_ID,
|
||||
targetUserProfileId: profile.userProfileId
|
||||
}
|
||||
|
||||
let event = {
|
||||
requestType: 'Event',
|
||||
eventMessage: JSON.stringify(eventMessage)
|
||||
}
|
||||
|
||||
await DK.webSocketsClient.sendMessage(
|
||||
JSON.stringify(event)
|
||||
)
|
||||
.then(followAdded)
|
||||
.catch(onError)
|
||||
|
||||
function followAdded() {
|
||||
console.log("User Profile " + profile.userProfileHandle + " followed.")
|
||||
}
|
||||
console.log(profile)
|
||||
}
|
||||
}
|
||||
/*
|
||||
Test Query User Profile Stats.
|
||||
*/
|
||||
queryMessage = {
|
||||
queryType: SA.projects.socialTrading.globals.queryTypes.USER_PROFILE_STATS,
|
||||
emitterUserProfileId: DK.TEST_NETWORK_CLIENT_USER_PROFILE_ID,
|
||||
targetUserProfileId: DK.TEST_NETWORK_CLIENT_USER_PROFILE_ID
|
||||
}
|
||||
|
||||
query = {
|
||||
requestType: 'Query',
|
||||
queryMessage: JSON.stringify(queryMessage)
|
||||
}
|
||||
|
||||
await DK.webSocketsClient.sendMessage(
|
||||
JSON.stringify(query)
|
||||
)
|
||||
.then(showProfilesStats)
|
||||
.catch(onError)
|
||||
|
||||
function showProfilesStats(profile) {
|
||||
console.log(profile)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Error Handling
|
||||
*/
|
||||
|
||||
@@ -10,7 +10,16 @@ function newWebAppPostLoader() {
|
||||
function start() {
|
||||
try {
|
||||
|
||||
setupProjectsSchema()
|
||||
setupEnvironment()
|
||||
|
||||
function setupEnvironment() {
|
||||
httpRequest(undefined, 'Environment', onResponse)
|
||||
|
||||
function onResponse(err, file) {
|
||||
ENVIRONMENT = JSON.parse(file)
|
||||
setupProjectsSchema()
|
||||
}
|
||||
}
|
||||
|
||||
function setupProjectsSchema() {
|
||||
httpRequest(undefined, 'ProjectsSchema', onResponse)
|
||||
|
||||
Reference in new issue
Block a user