Port Already in Use Bug
This commit is contained in:
1 parent
3eb034a93d
commit
cf009b60e2
12 files changed
+185
-80
No files matched your search
@@ -1,7 +1,7 @@
|
||||
|
||||
#PORT NUMBERS: If any of these ports are already in use by a different app, please pick a new number between 1 and 50000.
|
||||
WEB_SERVER_PORT=34248
|
||||
WEB_SOCKETS_SERVER_PORT=8081
|
||||
WEB_SOCKETS_SERVER_PORT=18041
|
||||
|
||||
|
||||
# TASK MANAGER VARIABLES:
|
||||
|
||||
+2
-2
@@ -12521,7 +12521,7 @@
|
||||
"config": true
|
||||
},
|
||||
"initialValues": {
|
||||
"config": "{ \n\"xxx\": \"\"\n}"
|
||||
"config": "{ \n\"distanceBetweenNodes\": 500\n}"
|
||||
},
|
||||
"menuItems": [
|
||||
{
|
||||
@@ -14699,7 +14699,7 @@
|
||||
"propertyToCheckFor": "includedFilePosition",
|
||||
"actionFunction": "payload.onMenuItemClick",
|
||||
"label": "Add Included File Position",
|
||||
"relatedUiObject": "Included File Position",
|
||||
"relatedUiObject": "Included File Position"
|
||||
},
|
||||
{
|
||||
"action": "Delete UI Object",
|
||||
|
||||
+1
-1
@@ -8,6 +8,6 @@ WRITE_LOGS_TO_FILES=true
|
||||
BOTS_PATH=../Legacy-Code
|
||||
LOG_PATH=../Log-Files
|
||||
|
||||
WEB_SOCKETS_SERVER_PORT=8081
|
||||
WEB_SOCKETS_SERVER_PORT=18041
|
||||
WEB_SERVER_PORT=34248
|
||||
WEB_SERVER_URL=localhost
|
||||
@@ -189,7 +189,7 @@ function newCircularMenu() {
|
||||
function onFocus() {
|
||||
for (let i = 0; i < menuItems.length; i++) {
|
||||
let menuItem = menuItems[i]
|
||||
menuItem.targetRadius = menuItem.rawRadius * 1.5
|
||||
menuItem.targetRadius = menuItem.rawRadius * 1.5 * canvas.floatingSpace.settings.node.menuItem.radiusPercentage / 100
|
||||
menuItem.isDeployed = true
|
||||
}
|
||||
thisObject.isDeployed = true
|
||||
|
||||
@@ -59,7 +59,7 @@ function newCircularMenuItem() {
|
||||
thisObject.container.frame.position.x = 0
|
||||
thisObject.container.frame.position.y = 0
|
||||
thisObject.container.frame.width = 0
|
||||
thisObject.container.frame.height = 40
|
||||
thisObject.container.frame.height = 0
|
||||
|
||||
let isMouseOver = false
|
||||
|
||||
@@ -73,8 +73,6 @@ function newCircularMenuItem() {
|
||||
let temporaryStatus = 0
|
||||
let temporaryStatusCounter = 0
|
||||
|
||||
const EXTRA_MOUSE_OVER_ICON_SIZE = 6
|
||||
|
||||
const STATUS_NO_ACTION_TAKEN_YET = 0
|
||||
const STATUS_PRIMARY_ACTION_WORKING = -1
|
||||
const STATUS_SECONDARY_ACTION_WORKING = -2
|
||||
@@ -113,11 +111,7 @@ function newCircularMenuItem() {
|
||||
selfMouseClickEventSubscriptionId = thisObject.container.eventHandler.listenToEvent('onMouseClick', onMouseClick)
|
||||
selfMouseNotOverEventSubscriptionId = thisObject.container.eventHandler.listenToEvent('onMouseNotOver', onMouseNotOver)
|
||||
|
||||
if (thisObject.type === 'Icon & Text') {
|
||||
thisObject.container.frame.width = 220
|
||||
} else {
|
||||
thisObject.container.frame.width = 50
|
||||
}
|
||||
containerPhysics()
|
||||
|
||||
thisObject.nextAction = thisObject.action
|
||||
}
|
||||
@@ -155,7 +149,15 @@ function newCircularMenuItem() {
|
||||
|
||||
function physics() {
|
||||
if (thisObject.dontShowAtFullscreen === true && AT_FULL_SCREEN_MODE === true) { return }
|
||||
positionPhysics()
|
||||
temporaryStatusPhysics()
|
||||
disablePhysics()
|
||||
iconPhysics()
|
||||
backgroundColorPhysics()
|
||||
containerPhysics()
|
||||
}
|
||||
|
||||
function positionPhysics() {
|
||||
let INCREASE_STEP = 2
|
||||
|
||||
if (Math.abs(thisObject.currentRadius - thisObject.targetRadius) >= INCREASE_STEP) {
|
||||
@@ -201,9 +203,9 @@ function newCircularMenuItem() {
|
||||
radiusGrowthFactor / 7
|
||||
* Math.sin(toRadians(thisObject.angle)) -
|
||||
thisObject.container.frame.height / 2
|
||||
}
|
||||
|
||||
temporaryStatusPhysics()
|
||||
|
||||
function disablePhysics() {
|
||||
/* Here we will check if we need to monitor a property that influences the status of the Menu Item. */
|
||||
if (thisObject.disableIfPropertyIsDefined === true) {
|
||||
if (thisObject.payload.node[thisObject.propertyToCheckFor] === undefined) {
|
||||
@@ -214,11 +216,19 @@ function newCircularMenuItem() {
|
||||
thisObject.isEnabled = false
|
||||
}
|
||||
}
|
||||
iconPhysics()
|
||||
backgroundColorPhysics()
|
||||
}
|
||||
|
||||
function backgroundColorPhysics(){
|
||||
function containerPhysics() {
|
||||
if (thisObject.type === 'Icon & Text') {
|
||||
thisObject.container.frame.width = 220 * canvas.floatingSpace.settings.node.menuItem.widthPercentage / 100
|
||||
} else {
|
||||
thisObject.container.frame.width = 50 * canvas.floatingSpace.settings.node.menuItem.widthPercentage / 100
|
||||
}
|
||||
|
||||
thisObject.container.frame.height = 40 * canvas.floatingSpace.settings.node.menuItem.heightPercentage / 100
|
||||
}
|
||||
|
||||
function backgroundColorPhysics() {
|
||||
defaultBackgroudColor = canvas.floatingSpace.style.node.menuItem.backgroundColor
|
||||
}
|
||||
|
||||
@@ -443,9 +453,9 @@ function newCircularMenuItem() {
|
||||
/* Menu Item */
|
||||
let iconSize
|
||||
if (isMouseOver === true) {
|
||||
iconSize = thisObject.currentRadius + EXTRA_MOUSE_OVER_ICON_SIZE
|
||||
iconSize = canvas.floatingSpace.style.node.menuItem.imageSize * 150 / 100
|
||||
} else {
|
||||
iconSize = thisObject.currentRadius
|
||||
iconSize = canvas.floatingSpace.style.node.menuItem.imageSize
|
||||
}
|
||||
|
||||
if (thisObject.icon === undefined) { return }
|
||||
|
||||
@@ -290,6 +290,8 @@ function newFloatingLayer() {
|
||||
DEBUG.variable1 = 'Invisible Floating Objets: ' + invisibleFloatingObjects.length
|
||||
DEBUG.variable2 = 'Visible Floating Objets: ' + visibleFloatingObjects.length
|
||||
|
||||
if (canvas.floatingSpace.settings.physics !== true) {return}
|
||||
|
||||
for (let i = 0; i < visibleFloatingObjects.length; i++) {
|
||||
let floatingObject = visibleFloatingObjects[i]
|
||||
if (floatingObject.isFrozen === true) { continue }
|
||||
|
||||
@@ -340,7 +340,7 @@ function newFloatingObject() {
|
||||
function positionContraintsPhysics() {
|
||||
const MAX_DISTANCE_TO_PARENT = 5000
|
||||
const MIN_DISTANCE_TO_PARENT = 100
|
||||
const DEFAULT_NODE_TO_NODE_DISTANCE = 500
|
||||
const DEFAULT_NODE_TO_NODE_DISTANCE = 500 * canvas.floatingSpace.settings.node.distancePercentage / 100
|
||||
|
||||
if (thisObject.angleToParent !== ANGLE_TO_PARENT.NOT_FIXED && thisObject.isOnFocus !== true) {
|
||||
let parent = thisObject.payload.chainParent
|
||||
@@ -615,7 +615,8 @@ function newFloatingObject() {
|
||||
}
|
||||
|
||||
function setFocus(point) {
|
||||
thisObject.targetRadius = thisObject.rawRadius * 6.0
|
||||
thisObject.targetRadius = thisObject.rawRadius * 6.0 * canvas.floatingSpace.settings.node.radiusPercentage / 100
|
||||
thisObject.currentMass = thisObject.rawMass * canvas.floatingSpace.settings.node.massPercentage / 100
|
||||
thisObject.targetImageSize = thisObject.rawImageSize * 2.0
|
||||
thisObject.targetFontSize = thisObject.rawFontSize * 2.0
|
||||
thisObject.targetHierarchyRing = thisObject.rawHierarchyRing * 8.0
|
||||
@@ -634,7 +635,8 @@ function newFloatingObject() {
|
||||
}
|
||||
if (thisObject.payload === undefined) { return }
|
||||
if (thisObject.isOnFocus === true) {
|
||||
thisObject.targetRadius = thisObject.rawRadius * 1
|
||||
thisObject.targetRadius = thisObject.rawRadius * 1 * canvas.floatingSpace.settings.node.radiusPercentage / 100
|
||||
thisObject.currentMass = thisObject.rawMass * canvas.floatingSpace.settings.node.massPercentage / 100
|
||||
thisObject.targetImageSize = thisObject.rawImageSize * 1
|
||||
thisObject.targetFontSize = thisObject.rawFontSize * 1
|
||||
thisObject.targetHierarchyRing = thisObject.rawHierarchyRing * 1
|
||||
@@ -719,7 +721,7 @@ function newFloatingObject() {
|
||||
}
|
||||
|
||||
thisObject.rawRadius = radius
|
||||
thisObject.targetRadius = radius
|
||||
thisObject.targetRadius = radius * canvas.floatingSpace.settings.node.radiusPercentage / 100
|
||||
thisObject.container.frame.radius = radius
|
||||
|
||||
thisObject.container.eventHandler.raiseEvent('Dimmensions Changed', event)
|
||||
|
||||
@@ -15,6 +15,7 @@ function newFloatingSpace() {
|
||||
drawReferenceLines: false,
|
||||
drawChainLines: true,
|
||||
style: undefined,
|
||||
settings: undefined,
|
||||
toggleDrawChainLines: toggleDrawChainLines,
|
||||
toggleDrawReferenceLines: toggleDrawReferenceLines,
|
||||
toggleMapMode: toggleMapMode,
|
||||
@@ -79,11 +80,27 @@ function newFloatingSpace() {
|
||||
menuItem: {
|
||||
backgroundColor: UI_COLOR.BLACK,
|
||||
fontColor: UI_COLOR.WHITE,
|
||||
fontSize: 15
|
||||
fontSize: 15,
|
||||
imageSize: 50
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Default Settings */
|
||||
thisObject.settings = {
|
||||
node: {
|
||||
distancePercentage: 100,
|
||||
radiusPercentage: 100,
|
||||
massPercentage: 100,
|
||||
menuItem: {
|
||||
widthPercentage: 100,
|
||||
heightPercentage: 100,
|
||||
radiusPercentage: 100
|
||||
}
|
||||
},
|
||||
physics: true
|
||||
}
|
||||
|
||||
return thisObject
|
||||
|
||||
function finalize() {
|
||||
@@ -407,6 +424,7 @@ function newFloatingSpace() {
|
||||
function physics() {
|
||||
if (visible === false) { return }
|
||||
syncStylePhysics()
|
||||
syncSettingsPhysics()
|
||||
browserZoomPhysics()
|
||||
positionContraintsPhysics()
|
||||
thisObject.floatingLayer.physics()
|
||||
@@ -418,6 +436,7 @@ function newFloatingSpace() {
|
||||
let designSpaceNode = canvas.designSpace.workspace.getHierarchyHeadsByType('Design Space')
|
||||
if (designSpaceNode === undefined) { return }
|
||||
if (designSpaceNode.spaceStyle === undefined) { return }
|
||||
let configStyle
|
||||
try {
|
||||
configStyle = JSON.parse(designSpaceNode.spaceStyle.config)
|
||||
} catch (err) {
|
||||
@@ -456,9 +475,54 @@ function newFloatingSpace() {
|
||||
if (configStyle.node.menuItem.fontSize !== undefined) {
|
||||
thisObject.style.node.menuItem.fontSize = configStyle.node.menuItem.fontSize
|
||||
}
|
||||
if (configStyle.node.menuItem.imageSize !== undefined) {
|
||||
thisObject.style.node.menuItem.imageSize = configStyle.node.menuItem.imageSize
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function syncSettingsPhysics() {
|
||||
if (canvas.designSpace === undefined) { return }
|
||||
if (canvas.designSpace.workspace === undefined) { return }
|
||||
let designSpaceNode = canvas.designSpace.workspace.getHierarchyHeadsByType('Design Space')
|
||||
if (designSpaceNode === undefined) { return }
|
||||
if (designSpaceNode.spaceSettings === undefined) { return }
|
||||
let configSettings
|
||||
try {
|
||||
configSettings = JSON.parse(designSpaceNode.spaceSettings.config)
|
||||
} catch (err) {
|
||||
if (thisObject.payload !== undefined) {
|
||||
thisObject.payload.uiObject.setErrorMessage(err.message)
|
||||
}
|
||||
return
|
||||
}
|
||||
if (configSettings.node !== undefined) {
|
||||
if (configSettings.node.distancePercentage !== undefined) {
|
||||
thisObject.settings.node.distancePercentage = configSettings.node.distancePercentage
|
||||
}
|
||||
if (configSettings.node.radiusPercentage !== undefined) {
|
||||
thisObject.settings.node.radiusPercentage = configSettings.node.radiusPercentage
|
||||
}
|
||||
if (configSettings.node.massPercentage !== undefined) {
|
||||
thisObject.settings.node.massPercentage = configSettings.node.massPercentage
|
||||
}
|
||||
if (configSettings.node.menuItem !== undefined) {
|
||||
if (configSettings.node.menuItem.widthPercentage !== undefined) {
|
||||
thisObject.settings.node.menuItem.widthPercentage = configSettings.node.menuItem.widthPercentage
|
||||
}
|
||||
if (configSettings.node.menuItem.heightPercentage !== undefined) {
|
||||
thisObject.settings.node.menuItem.heightPercentage = configSettings.node.menuItem.heightPercentage
|
||||
}
|
||||
if (configSettings.node.menuItem.radiusPercentage !== undefined) {
|
||||
thisObject.settings.node.menuItem.radiusPercentage = configSettings.node.menuItem.radiusPercentage
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (configSettings.physics !== undefined) {
|
||||
thisObject.settings.physics = configSettings.physics
|
||||
}
|
||||
}
|
||||
|
||||
function positionContraintsPhysics() {
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"type":"Workspace","name":"My Default Workspace","rootNodes":[{"type":"Network","name":"My Network","networkNodes":[{"type":"Network Node","name":"My Computer","config":"{ \n\"host\": \"localhost\", \n\"webPort\": \"34248\", \n\"webSocketsPort\": \"8081\"\n}","dataMining":{"type":"Data Mining","name":"New Data Mining","exchangeDataTasks":[{"type":"Exchange Data Tasks","name":"Binance","marketDataTasks":[{"type":"Market Data Tasks","name":"Binance BTC/USDT","dataMineTasks":[{"type":"Data Mine Tasks","name":"Masters","taskManagers":[{"type":"Task Manager","name":"Masters","tasks":[{"type":"Task","name":"Exchange Raw Data","bot":{"type":"Sensor Bot Instance","name":"Exchange Raw Data","config":"{ \n\"startDate\": \"2020-01-01\"\n}","processes":[{"type":"Sensor Process Instance","name":"Exchange Raw Data Historic-OHLCVs","id":"d244c564-4e86-43c7-9796-dc3b6294ec8b","savedPayload":{"position":{"x":23351.314277844434,"y":27974.785575589776},"targetPosition":{"x":23796.728123492587,"y":28201.627455815993},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":true},"referenceParent":{"type":"Process Definition","name":"Historic-OHLCVs","id":"5eb11d6a-022e-4f60-97c4-d6cf90b249dc"}}}],"id":"343313ae-5705-484d-8bf8-aed25ba61cfa","savedPayload":{"position":{"x":23796.728123492587,"y":28201.627455815993},"targetPosition":{"x":24242.102991685497,"y":28428.377563185066},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false}}},"id":"a8f38508-1cac-4ab1-815f-d338fc813377","savedPayload":{"position":{"x":24242.102991685497,"y":28428.377563185066},"targetPosition":{"x":24687.607575835034,"y":28655.130355168047},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":true}}},{"type":"Task","name":"Candles Volumes","bot":{"type":"Indicator Bot Instance","name":"Candles Volumes","config":"{}","processes":[{"type":"Indicator Process Instance","name":"Candles Volumes Multi-Period-Market","id":"f0ef12ed-f0fd-4b88-8e15-27cf24265a5f","savedPayload":{"position":{"x":24007.267430337823,"y":27369.922290858955},"targetPosition":{"x":24378.75779785189,"y":27704.417915023907},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":true},"referenceParent":{"type":"Process Definition","name":"Multi-Period-Market","id":"9f683143-a33f-42c1-9fa8-c601f01ee4e1"}}},{"type":"Indicator Process Instance","name":"Candles Volumes Multi-Period-Daily","id":"7c8b312c-09bf-4c59-853f-1592391a9c57","savedPayload":{"position":{"x":24482.557214393688,"y":27215.410794575077},"targetPosition":{"x":24378.75779785189,"y":27704.417915023907},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":true},"referenceParent":{"type":"Process Definition","name":"Multi-Period-Daily","id":"980ceb1d-7be6-454f-90d9-01ba1fd4a65d"}}}],"id":"8d58e84b-d7ef-464f-8079-0ec0887e3da3","savedPayload":{"position":{"x":24378.75779785189,"y":27704.417915023907},"targetPosition":{"x":24533.163695070733,"y":28179.720702819992},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false}}},"id":"bf29e3bd-9386-408b-9091-042da0c53e81","savedPayload":{"position":{"x":24533.163695070733,"y":28179.720702819992},"targetPosition":{"x":24687.607575835034,"y":28655.130355168047},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":true}}},{"type":"Task","name":"Resistances and Supports","bot":{"type":"Indicator Bot Instance","name":"Resistances and Supports","config":"{}","processes":[{"type":"Indicator Process Instance","name":"Resistances and Supports Multi-Period-Market","id":"a707814e-b81b-4102-9b5b-4e2fe969324f","savedPayload":{"position":{"x":25115.61142084002,"y":27265.367258518418},"targetPosition":{"x":25141.595034652833,"y":27764.590540263827},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":true},"referenceParent":{"type":"Process Definition","name":"Multi-Period-Market","id":"5d9b2729-43fb-4e7e-aa4f-b8477c424e51"}}},{"type":"Indicator Process Instance","name":"Resistances and Supports Multi-Period-Daily","id":"c5395fbe-4b5a-4492-a7fb-e2d259905e27","savedPayload":{"position":{"x":25560.869088302887,"y":27492.38766494412},"targetPosition":{"x":25141.595034652833,"y":27764.590540263827},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"Line truncated
|
||||
{"type":"Workspace","name":"My Default Workspace","rootNodes":[{"type":"Network","name":"My Network","networkNodes":[{"type":"Network Node","name":"My Computer","config":"{ \n\"host\": \"localhost\", \n\"webPort\": \"34248\", \n\"webSocketsPort\": \"18041\"\n}","dataMining":{"type":"Data Mining","name":"New Data Mining","exchangeDataTasks":[{"type":"Exchange Data Tasks","name":"Binance","marketDataTasks":[{"type":"Market Data Tasks","name":"Binance BTC/USDT","dataMineTasks":[{"type":"Data Mine Tasks","name":"Masters","taskManagers":[{"type":"Task Manager","name":"Masters","tasks":[{"type":"Task","name":"Exchange Raw Data","bot":{"type":"Sensor Bot Instance","name":"Exchange Raw Data","config":"{ \n\"startDate\": \"2020-01-01\"\n}","processes":[{"type":"Sensor Process Instance","name":"Exchange Raw Data Historic-OHLCVs","id":"d244c564-4e86-43c7-9796-dc3b6294ec8b","savedPayload":{"position":{"x":23351.241785878396,"y":27974.773075724926},"targetPosition":{"x":23796.663242380724,"y":28201.625465224624},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false},"referenceParent":{"type":"Process Definition","name":"Historic-OHLCVs","id":"5eb11d6a-022e-4f60-97c4-d6cf90b249dc"}}}],"id":"343313ae-5705-484d-8bf8-aed25ba61cfa","savedPayload":{"position":{"x":23796.663242380724,"y":28201.625465224624},"targetPosition":{"x":24241.99396516499,"y":28428.327720790356},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false}}},"id":"a8f38508-1cac-4ab1-815f-d338fc813377","savedPayload":{"position":{"x":24241.92481783773,"y":28428.246308714763},"targetPosition":{"x":24687.45725163592,"y":28654.86033544639},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false}}},{"type":"Task","name":"Candles Volumes","bot":{"type":"Indicator Bot Instance","name":"Candles Volumes","config":"{}","processes":[{"type":"Indicator Process Instance","name":"Candles Volumes Multi-Period-Market","id":"f0ef12ed-f0fd-4b88-8e15-27cf24265a5f","savedPayload":{"position":{"x":24007.2545755358,"y":27369.785851600962},"targetPosition":{"x":24378.74953158194,"y":27704.29200237889},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false},"referenceParent":{"type":"Process Definition","name":"Multi-Period-Market","id":"9f683143-a33f-42c1-9fa8-c601f01ee4e1"}}},{"type":"Indicator Process Instance","name":"Candles Volumes Multi-Period-Daily","id":"7c8b312c-09bf-4c59-853f-1592391a9c57","savedPayload":{"position":{"x":24482.54569936825,"y":27215.273909826174},"targetPosition":{"x":24378.74953158194,"y":27704.29200237889},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false},"referenceParent":{"type":"Process Definition","name":"Multi-Period-Daily","id":"980ceb1d-7be6-454f-90d9-01ba1fd4a65d"}}}],"id":"8d58e84b-d7ef-464f-8079-0ec0887e3da3","savedPayload":{"position":{"x":24378.74953158194,"y":27704.29200237889},"targetPosition":{"x":24533.116312693106,"y":28179.56238518478},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false}}},"id":"bf29e3bd-9386-408b-9091-042da0c53e81","savedPayload":{"position":{"x":24533.041954619006,"y":28179.488778038016},"targetPosition":{"x":24687.45725163592,"y":28654.86033544639},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false}}},{"type":"Task","name":"Resistances and Supports","bot":{"type":"Indicator Bot Instance","name":"Resistances and Supports","config":"{}","processes":[{"type":"Indicator Process Instance","name":"Resistances and Supports Multi-Period-Market","id":"a707814e-b81b-4102-9b5b-4e2fe969324f","savedPayload":{"position":{"x":25115.54949279387,"y":27265.302382994087},"targetPosition":{"x":25141.53470211686,"y":27764.53788491591},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceToParent":3,"arrangementStyle":0},"uiObject":{"isRunning":false},"referenceParent":{"type":"Process Definition","name":"Multi-Period-Market","id":"5d9b2729-43fb-4e7e-aa4f-b8477c424e51"}}},{"type":"Indicator Process Instance","name":"Resistances and Supports Multi-Period-Daily","id":"c5395fbe-4b5a-4492-a7fb-e2d259905e27","savedPayload":{"position":{"x":25560.808615201386,"y":27492.321014526064},"targetPosition":{"x":25141.53470211686,"y":27764.53788491591},"floatingObject":{"isPinned":false,"isFrozen":false,"isCollapsed":false,"angleToParent":2,"distanceTLine truncated
|
||||
+1
-1
@@ -8,6 +8,6 @@ WRITE_LOGS_TO_FILES=true
|
||||
BOTS_PATH=../Legacy-Code
|
||||
LOG_PATH=../Log-Files
|
||||
|
||||
WEB_SOCKETS_SERVER_PORT=8081
|
||||
WEB_SOCKETS_SERVER_PORT=18041
|
||||
WEB_SERVER_PORT=34248
|
||||
WEB_SERVER_URL=localhost
|
||||
@@ -1,7 +1,7 @@
|
||||
exports.newEventsServerClient = function newEventsServerClient(host, port) {
|
||||
|
||||
const MODULE = "Task Server "
|
||||
const ERROR_LOG = true
|
||||
|
||||
const INFO_LOG = false
|
||||
|
||||
let thisObject = {
|
||||
@@ -27,6 +27,8 @@
|
||||
port = process.env.WEB_SOCKETS_SERVER_PORT
|
||||
}
|
||||
|
||||
let messageCounter = 0
|
||||
let commandCounter = 0
|
||||
|
||||
return thisObject
|
||||
|
||||
@@ -39,25 +41,32 @@
|
||||
function setuptWebSockets(callBackFunction) {
|
||||
try {
|
||||
|
||||
if (INFO_LOG === true) {
|
||||
console.log('setuptWebSockets at ' + host + ':' + port)
|
||||
}
|
||||
WEB_SOCKETS_CLIENT = new WEB_SOCKET('ws://' + host + ':' + port )
|
||||
|
||||
WEB_SOCKETS_CLIENT.onerror = error => {
|
||||
console.log('[ERROR] Task Server -> Event Server Client -> setuptWebSockets -> On connection error -> error = ' + JSON.stringify(error))
|
||||
WEB_SOCKETS_CLIENT.onerror = err => {
|
||||
console.log('[ERROR] Task Server -> Event Server Client -> setuptWebSockets -> On connection error -> error = ' + err.stack)
|
||||
console.log('[ERROR] This could mean that the port '+ port +' is taken by some other app running at your system. To resolve this issue, please pick another port number and change it at the .ENV file inside the Superalgos folder AND at the .ENV file inside the TaskServer folder. After that run the app again. ')
|
||||
}
|
||||
WEB_SOCKETS_CLIENT.onopen = () => {
|
||||
if (INFO_LOG === true) {
|
||||
console.log('Websocket connection opened.')
|
||||
}
|
||||
|
||||
if (callBackFunction !== undefined) {
|
||||
callBackFunction()
|
||||
try {
|
||||
if (INFO_LOG === true) {
|
||||
console.log('Websocket connection opened.')
|
||||
}
|
||||
|
||||
if (callBackFunction !== undefined) {
|
||||
callBackFunction()
|
||||
}
|
||||
} catch(err) {
|
||||
console.log('[ERROR] Task Server -> Event Server Client -> setuptWebSockets -> onopen -> err = ' + err.stack)
|
||||
}
|
||||
}
|
||||
WEB_SOCKETS_CLIENT.onmessage = e => {
|
||||
|
||||
try {
|
||||
if (INFO_LOG === true) {
|
||||
console.log('Websocket Message Received: ' + e.data)
|
||||
console.log('Websocket Message Received: ' + e.data.substring(0, 1000))
|
||||
}
|
||||
|
||||
let message = JSON.parse(e.data)
|
||||
@@ -84,11 +93,11 @@
|
||||
return
|
||||
}
|
||||
} catch (err) {
|
||||
if (ERROR_LOG === true) { logger.write('[ERROR] Task Server -> Event Server Client -> setuptWebSockets -> onmessage -> err = ' + err.stack) }
|
||||
console.log('[ERROR] Task Server -> Event Server Client -> setuptWebSockets -> onmessage -> err = ' + err.stack)
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
if (ERROR_LOG === true) { logger.write('[ERROR] Task Server -> Event Server Client -> setuptWebSockets -> err = ' + err.stack) }
|
||||
console.log('[ERROR] Task Server -> Event Server Client -> setuptWebSockets -> err = ' + err.stack)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,30 +118,35 @@
|
||||
}
|
||||
|
||||
function sendCommand(command, responseCallBack, eventsCallBack) {
|
||||
|
||||
if (command.action === 'listenToEvent') {
|
||||
let key
|
||||
if (command.callerId) {
|
||||
key = command.eventHandlerName + '-' + command.eventType + '-' + command.callerId
|
||||
try {
|
||||
if (command.action === 'listenToEvent') {
|
||||
let key
|
||||
if (command.callerId) {
|
||||
key = command.eventHandlerName + '-' + command.eventType + '-' + command.callerId
|
||||
} else {
|
||||
key = command.eventHandlerName + '-' + command.eventType
|
||||
}
|
||||
let handler = {
|
||||
eventHandlerName: command.eventHandlerName,
|
||||
eventType: command.eventType,
|
||||
callerId: command.callerId,
|
||||
callBack: eventsCallBack
|
||||
}
|
||||
eventListeners.set(key, handler)
|
||||
}
|
||||
if (command.callerId && responseCallBack) {
|
||||
responseWaiters.set(command.callerId, responseCallBack)
|
||||
}
|
||||
|
||||
if (WEB_SOCKETS_CLIENT.readyState === 1) { // 1 means connected and ready.
|
||||
|
||||
WEB_SOCKETS_CLIENT.send("Task Server" + "|*|" + "|*|" + JSON.stringify(command))
|
||||
|
||||
} else {
|
||||
key = command.eventHandlerName + '-' + command.eventType
|
||||
console.log('[ERROR] Task Server -> Event Server Client -> setuptWebSockets -> sendCommand -> WebSocket message could not be sent because the connection was not ready. Message = ' + JSON.stringify(command))
|
||||
}
|
||||
let handler = {
|
||||
eventHandlerName: command.eventHandlerName,
|
||||
eventType: command.eventType,
|
||||
callerId: command.callerId,
|
||||
callBack: eventsCallBack
|
||||
}
|
||||
eventListeners.set(key, handler)
|
||||
}
|
||||
if (command.callerId && responseCallBack) {
|
||||
responseWaiters.set(command.callerId, responseCallBack)
|
||||
}
|
||||
|
||||
if (WEB_SOCKETS_CLIENT.readyState === 1) { // 1 means connected and ready.
|
||||
WEB_SOCKETS_CLIENT.send("Task Server" + "|*|" + "|*|" + JSON.stringify(command))
|
||||
} else {
|
||||
console.log('[ERROR] Task Server -> Event Server Client -> setuptWebSockets -> sendCommand -> WebSocket message could not be sent because the connection was not ready. Message = ' + JSON.stringify(command))
|
||||
} catch(err) {
|
||||
console.log('[ERROR] Task Server -> Event Server Client -> sendCommand -> err = ' + err.stack)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+31
-18
@@ -1,5 +1,4 @@
|
||||
|
||||
|
||||
/* Callbacks default responses. */
|
||||
global.DEFAULT_OK_RESPONSE = {
|
||||
result: "Ok",
|
||||
@@ -316,7 +315,9 @@ function finalizeLoggers() {
|
||||
global.LOGGER_MAP.forEach(forEachLogger)
|
||||
|
||||
function forEachLogger(logger) {
|
||||
logger.finalize()
|
||||
if (logger !== undefined) {
|
||||
logger.finalize()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -375,12 +376,14 @@ global.EXIT_NODE_PROCESS = function exitProcess() {
|
||||
/* Cleaning Before Exiting. */
|
||||
clearInterval(global.HEARTBEAT_INTERVAL_HANDLER)
|
||||
|
||||
for (let i = 0; i < global.TASK_NODE.bot.processes.length; i++) {
|
||||
let config = global.TASK_NODE.bot.processes[i].config
|
||||
let process = global.TASK_NODE.bot.processes[i]
|
||||
|
||||
key = process.name + '-' + process.type + '-' + process.id
|
||||
global.EVENT_SERVER_CLIENT.raiseEvent(key, 'Stopped') // Meaning Process Stopped
|
||||
if (global.TASK_NODE !== undefined) {
|
||||
for (let i = 0; i < global.TASK_NODE.bot.processes.length; i++) {
|
||||
let config = global.TASK_NODE.bot.processes[i].config
|
||||
let process = global.TASK_NODE.bot.processes[i]
|
||||
|
||||
key = process.name + '-' + process.type + '-' + process.id
|
||||
global.EVENT_SERVER_CLIENT.raiseEvent(key, 'Stopped') // Meaning Process Stopped
|
||||
}
|
||||
}
|
||||
|
||||
finalizeLoggers()
|
||||
@@ -426,11 +429,15 @@ function preLoader() {
|
||||
global.EVENT_SERVER_CLIENT.listenToEvent('Task Server - ' + taskId, 'Run Task', undefined, 'Task Server - ' + taskId, undefined, eventReceived)
|
||||
global.EVENT_SERVER_CLIENT.raiseEvent('Task Manager - ' + taskId, 'Nodejs Process Ready for Task')
|
||||
function eventReceived(message) {
|
||||
global.APP_SCHEMA_ARRAY = JSON.parse(message.event.appSchema)
|
||||
setUpAppSchema()
|
||||
global.TASK_NODE = JSON.parse(message.event.taskDefinition)
|
||||
global.TASK_NETWORK = JSON.parse(message.event.networkDefinition)
|
||||
bootLoader()
|
||||
try {
|
||||
global.APP_SCHEMA_ARRAY = JSON.parse(message.event.appSchema)
|
||||
setUpAppSchema()
|
||||
global.TASK_NODE = JSON.parse(message.event.taskDefinition)
|
||||
global.TASK_NETWORK = JSON.parse(message.event.networkDefinition)
|
||||
bootLoader()
|
||||
} catch(err) {
|
||||
console.log('[ERROR] Task Server -> server -> preLoader -> eventReceived -> ' + err.stack)
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
console.log('[ERROR] Task Server -> server -> preLoader -> global.TASK_NODE -> ' + err.stack)
|
||||
@@ -442,11 +449,16 @@ function preLoader() {
|
||||
//console.log('[INFO] Task Server -> server -> preLoader -> Waiting for event to start debugging...')
|
||||
global.EVENT_SERVER_CLIENT.listenToEvent('Task Server', 'Debug Task Started', undefined, 'Task Server', undefined, startDebugging)
|
||||
function startDebugging(message) {
|
||||
global.APP_SCHEMA_ARRAY = JSON.parse(message.event.appSchema)
|
||||
setUpAppSchema()
|
||||
global.TASK_NODE = JSON.parse(message.event.taskDefinition)
|
||||
global.TASK_NETWORK = JSON.parse(message.event.networkDefinition)
|
||||
bootLoader()
|
||||
try {
|
||||
global.APP_SCHEMA_ARRAY = JSON.parse(message.event.appSchema)
|
||||
setUpAppSchema()
|
||||
global.TASK_NODE = JSON.parse(message.event.taskDefinition)
|
||||
global.TASK_NETWORK = JSON.parse(message.event.networkDefinition)
|
||||
bootLoader()
|
||||
|
||||
} catch(err) {
|
||||
console.log('[ERROR] Task Server -> server -> preLoader -> startDebugging -> ' + err.stack)
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
console.log('[ERROR] Task Server -> server -> preLoader -> global.TASK_NODE -> ' + err.stack)
|
||||
@@ -502,6 +514,7 @@ function bootLoader() {
|
||||
global.EVENT_SERVER_CLIENT.raiseEvent(key, 'Error', event)
|
||||
}
|
||||
|
||||
|
||||
for (let processIndex = 0; processIndex < global.TASK_NODE.bot.processes.length; processIndex++) {
|
||||
let config = global.TASK_NODE.bot.processes[processIndex].config
|
||||
|
||||
|
||||
Reference in new issue
Block a user