Ready to Test Peer Broadcasting
This commit is contained in:
1 parent
5324c94306
commit
8b28e9c09b
11 files changed
+188
-85
No files matched your search
+48
-28
@@ -1,11 +1,13 @@
|
||||
exports.newNetworkNode = function newNetworkNode() {
|
||||
|
||||
let thisObject = {
|
||||
userProfiles: undefined,
|
||||
p2pNetwork: undefined,
|
||||
p2pNetworkPeers: undefined,
|
||||
p2pNetworkNode: undefined,
|
||||
webSocketsInterface: undefined,
|
||||
socialGraphService: undefined,
|
||||
storage: undefined,
|
||||
p2pNetwork: undefined,
|
||||
p2pNetworkPeers: undefined,
|
||||
run: run
|
||||
}
|
||||
|
||||
@@ -14,32 +16,50 @@ exports.newNetworkNode = function newNetworkNode() {
|
||||
return thisObject
|
||||
|
||||
async function run() {
|
||||
/*
|
||||
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()
|
||||
/*
|
||||
Let's discover who is at the p2p network.
|
||||
*/
|
||||
thisObject.p2pNetwork = SA.projects.network.modules.p2pNetwork.newNetworkModulesP2PNetwork()
|
||||
await thisObject.p2pNetwork.initialize('Network Peer')
|
||||
/*
|
||||
We can join now the P2P Network as a new peer there.
|
||||
*/
|
||||
thisObject.p2pNetworkPeers = SA.projects.network.modules.p2pNetworkPeers.newNetworkModulesP2PNetworkPeers()
|
||||
await thisObject.p2pNetworkPeers.initialize()
|
||||
/*
|
||||
Other Network Nodes and Client Apps will communicate with this Network Node via it's Websocket Interface.
|
||||
*/
|
||||
thisObject.webSocketsInterface = NT.projects.network.modules.webSocketsInterface.newNetworkModulesWebSocketsInterface()
|
||||
thisObject.webSocketsInterface.initialize()
|
||||
console.log('Network Node Web Sockets Interface ....................................... Listening at port ' + JSON.parse(NT.networkNode.p2pNetwork.thisNetworkNode.node.config).webSocketsPort)
|
||||
|
||||
await setupNetwork()
|
||||
await setupServices()
|
||||
|
||||
async function setupNetwork() {
|
||||
/*
|
||||
We set up ourselves as a Network Node.
|
||||
*/
|
||||
thisObject.p2pNetworkNode = SA.projects.network.modules.p2pNetworkNode.newNetworkModulesP2PNetworkNode()
|
||||
await thisObject.p2pNetworkNode.initialize()
|
||||
/*
|
||||
We will read all user profiles plugins and get from there our network identity.
|
||||
*/
|
||||
thisObject.userProfiles = SA.projects.network.modules.userProfiles.newNetworkModulesUserProfiles()
|
||||
await thisObject.userProfiles.initialize(global.env.P2P_NETWORK_NODE_SIGNING_ACCOUNT, thisObject.p2pNetworkNode)
|
||||
/*
|
||||
Let's discover who is at the p2p network.
|
||||
*/
|
||||
thisObject.p2pNetwork = SA.projects.network.modules.p2pNetwork.newNetworkModulesP2PNetwork()
|
||||
await thisObject.p2pNetwork.initialize('Network Peer')
|
||||
/*
|
||||
We can join now the P2P Network as a new peer there.
|
||||
*/
|
||||
thisObject.p2pNetworkPeers = SA.projects.network.modules.p2pNetworkPeers.newNetworkModulesP2PNetworkPeers()
|
||||
await thisObject.p2pNetworkPeers.initialize()
|
||||
}
|
||||
|
||||
async function setupServices() {
|
||||
/*
|
||||
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()
|
||||
/*
|
||||
Other Network Nodes and Client Apps will communicate with this Network Node via it's Websocket Interface.
|
||||
*/
|
||||
thisObject.webSocketsInterface = NT.projects.network.modules.webSocketsInterface.newNetworkModulesWebSocketsInterface()
|
||||
thisObject.webSocketsInterface.initialize()
|
||||
console.log('Network Node Web Sockets Interface ....................................... Listening at port ' + JSON.parse(NT.networkNode.p2pNetworkNode.node.config).webSocketsPort)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user