Websocket client errors documented

This commit is contained in:
Luis Fernando Molina committed 2021-01-17 14:45:03 +01:00
1 parent 6c15c5c1c6
commit 4707cc6d69
6 files changed
+183 -27

No files matched your search

@@ -3,14 +3,104 @@
"pageNumber": "1",
"type": "UI Websockets Error - Bad Configuration",
"definition": {
"text": "To enable websockets communications from the UI to Superalgos Clients, we need to read the config of the Network Node. In this case this configuration is unreadable because is not correctly formatted in JSON.",
"updated": 1610882552794
"text": "To enable websockets communications from the UI to Superalgos Clients, we need to read the config of the Network Node. If anything is wrong with that configuration, the UI will not be able to communicate with the Client via websockets and many things, like running a Task will not be possible.",
"updated": 1610887696051
},
"paragraphs": [
{
"style": "Text",
"text": "There are several reasons for the UI Web Sockets Client to report a Bad Configuration error. They are all listed below.",
"updated": 1610889008413
},
{
"style": "Anchor",
"text": "Invalid JSON Format"
},
{
"style": "Title",
"text": "Reason #1: Invalid JSON Format",
"updated": 1610889030985
},
{
"style": "Text",
"text": "To enable websockets communications from the UI to Superalgos Clients, we need to read the config of the Network Node. In this case this configuration is unreadable because is not correctly formatted in JSON."
},
{
"style": "Error",
"text": "Bad Configuration - Invalid JSON Format",
"updated": 1610889068414
},
{
"style": "Success",
"text": "Edit the configuration and double check that is correctly formatted. If needed copy the text to an online JSON formatter to see clearly which is the problem.",
"updated": 1610882640511
"text": "Edit the configuration and double check that is correctly formatted. If needed, copy the text to an online JSON formatter to see clearly which is the problem.",
"updated": 1610887620569
},
{
"style": "Note",
"text": "This page contains several error conditions. When clicking at the Error Menssage at a node, you are redirected within this page to the section where the the error that is happening at that node is explained."
},
{
"style": "Anchor",
"text": "Host Property Not Found"
},
{
"style": "Title",
"text": "Reason #2: Host Property Not Found"
},
{
"style": "Text",
"text": "The following property was expected and not found at the Network Node config:",
"updated": 1610889169227
},
{
"style": "Json",
"text": "host"
},
{
"style": "Error",
"text": "Bad Configuration - Host Property Not Found",
"updated": 1610889199843
},
{
"style": "Success",
"text": "Double check that you did not misspell this property. It's value should be the hostName or IP number of the computer / server hosting the Superalgos Client.",
"updated": 1610889251223
},
{
"style": "Note",
"text": "This page contains several error conditions. When clicking at the Error Menssage at a node, you are redirected within this page to the section where the the error that is happening at that node is explained."
},
{
"style": "Anchor",
"text": "WebSocketsPort Property Not Found",
"updated": 1610889501929
},
{
"style": "Title",
"text": "Reason #3: WebSocketsPort Property Not Found"
},
{
"style": "Text",
"text": "The following property was expected and not found at the Network Node config:"
},
{
"style": "Json",
"text": "webSocketsPort",
"updated": 1610889416628
},
{
"style": "Error",
"text": "Error: Bad Configuration - WebSocketsPort Property Not Found",
"updated": 1610889423432
},
{
"style": "Success",
"text": "Tip: Double check that you did not misspell this property. It's value should be the port number configured for the Client Websockets Interface.",
"updated": 1610889486046
},
{
"style": "Note",
"text": "This page contains several error conditions. When clicking at the Error Menssage at a node, you are redirected within this page to the section where the the error that is happening at that node is explained."
}
]
}
@@ -125,6 +125,10 @@ function newUiObject() {
let warningMessage = ''
let infoMessage = ''
let errorDocs = undefined
let warningDocs = undefined
let infoDocs = undefined
let currentValue = 0
let valueMinDecimals = undefined
let currentPercentage = ''
@@ -203,6 +207,10 @@ function newUiObject() {
lastHeartBeat = undefined
onRunningCallBackFunction = undefined
errorDocs = undefined
warningDocs = undefined
infoDocs = undefined
}
function finalizeEventsServerClient() {
@@ -831,9 +839,10 @@ function newUiObject() {
runningAtBackendCounter = 5
}
function setErrorMessage(message, duration) {
function setErrorMessage(message, duration, docs) {
if (message !== undefined) {
errorMessage = message
errorDocs = docs
thisObject.hasError = true
if (duration === undefined) { duration = 2 }
errorMessageCounter = 100 * duration
@@ -863,6 +872,7 @@ function newUiObject() {
function resetErrorMessage() {
errorMessage = undefined
errorDocs = undefined
thisObject.hasError = false
if (thisObject.uiObjectMessage.type === 'Error') {
@@ -871,9 +881,10 @@ function newUiObject() {
}
}
function setWarningMessage(message, duration) {
function setWarningMessage(message, duration, docs) {
if (message !== undefined) {
warningMessage = message
warningDocs = docs
thisObject.hasWarning = true
if (duration === undefined) { duration = 1 }
warningMessageCounter = 100 * duration
@@ -903,6 +914,7 @@ function newUiObject() {
function resetWarningMessage() {
warningMessage = undefined
warningDocs = undefined
thisObject.hasWarning = false
if (thisObject.uiObjectMessage.type === 'Warning') {
@@ -911,9 +923,10 @@ function newUiObject() {
}
}
function setInfoMessage(message, duration) {
function setInfoMessage(message, duration, docs) {
if (message !== undefined) {
infoMessage = message
infoDocs = docs
thisObject.hasInfo = true
if (duration === undefined) { duration = 1 }
infoMessageCounter = 100 * duration
@@ -943,6 +956,7 @@ function newUiObject() {
function resetInfoMessage() {
infoMessage = undefined
infoDocs = undefined
thisObject.hasInfo = false
if (thisObject.uiObjectMessage.type === 'Info') {
@@ -1730,6 +1744,7 @@ function newUiObject() {
thisObject.uiObjectMessage.text = errorMessage
thisObject.uiObjectMessage.type = 'Error'
thisObject.uiObjectMessage.docs = errorDocs
}
function drawWarningMessage() {
@@ -1738,6 +1753,7 @@ function newUiObject() {
thisObject.uiObjectMessage.text = errorMessage
thisObject.uiObjectMessage.type = 'Warning'
thisObject.uiObjectMessage.docs = warningDocs
}
function drawInfoMessage() {
@@ -1747,6 +1763,7 @@ function newUiObject() {
thisObject.uiObjectMessage.text = errorMessage
thisObject.uiObjectMessage.type = 'Info'
thisObject.uiObjectMessage.docs = infoDocs
}
function drawValue() {
@@ -62,7 +62,7 @@ function newUiObjectMessage() {
/* Here we set the dimensions and position of this object */
const FRAME_HEIGHT = 120
const FRAME_WIDTH = 300
const FRAME_WIDTH = 350
thisObject.container.frame.position.x = - FRAME_WIDTH / 2
thisObject.container.frame.position.y = + 160
@@ -80,7 +80,19 @@ function newUiObjectMessage() {
checkPoint = thisObject.container.frame.frameThisPoint(checkPoint)
if (thisObject.isVisibleFunction(checkPoint) === true) {
// Open the docs and navigate.
if (thisObject.docs !== undefined) {
if (UI.projects.superalgos.spaces.docsSpace.sidePanelTab.isOpen === true) {
UI.projects.superalgos.spaces.docsSpace.sidePanelTab.close()
} else {
UI.projects.superalgos.spaces.docsSpace.openSpaceAreaAndNavigateTo(
thisObject.docs.project,
thisObject.docs.category,
thisObject.docs.type,
thisObject.docs.anchor
)
}
}
}
}
@@ -154,7 +166,7 @@ function newUiObjectMessage() {
if (radius > 6) {
const IDEAL_LABEL_LENGTH = 80
label = message
label = message
if (label !== undefined && label !== null) {
if (label.length > IDEAL_LABEL_LENGTH) {
@@ -177,7 +189,7 @@ function newUiObjectMessage() {
let phrase = phrases[i]
labelPoint = {
x: position.x - getTextWidth(phrase) / 2 + thisObject.container.frame.width / 2,
y: position.y + lineSeparator * (4 - phrases.length + 1 + i)
y: position.y + lineSeparator * (4 - phrases.length + 1 + i)
}
printMessage(phrase)
}
@@ -4,6 +4,8 @@ function newSidePanelTab() {
screenside: undefined,
pointerDirection: undefined,
container: undefined,
isOpen: false,
isClosed: true,
index: 0,
open: open,
close: close,
@@ -136,6 +138,8 @@ function newSidePanelTab() {
function animate() {
if (animation === 'opening') {
thisObject.isOpen = false
thisObject.isClosed = false
xOffset = xOffset + ANIMATION_STEP
switch (thisObject.screenside) {
case 'left': {
@@ -155,6 +159,8 @@ function newSidePanelTab() {
}
if (animation === 'closing') {
thisObject.isOpen = false
thisObject.isClosed = false
xOffset = xOffset - ANIMATION_STEP
switch (thisObject.screenside) {
case 'left': {
@@ -175,6 +181,7 @@ function newSidePanelTab() {
}
function setOpened() {
thisObject.isOpen = true
animation = 'none'
xOffset = thisObject.container.parentContainer.frame.width
thisObject.container.parentContainer.status = 'visible'
@@ -192,6 +199,7 @@ function newSidePanelTab() {
}
}
function setClosed() {
thisObject.isClosed = true
animation = 'none'
xOffset = 0
thisObject.container.parentContainer.status = 'hidden'
+4 -2
View File
@@ -147,7 +147,7 @@ function newCanvas() {
projectInstance.functionLibraries[functionLibraryDefinition.propertyName] = eval(functionLibraryDefinition.functionName + '()')
}
}
/* Space Instantiation */
if (projectDefinition.UI.spaces === undefined) { continue }
for (let j = 0; j < projectDefinition.UI.spaces.length; j++) {
@@ -372,7 +372,9 @@ function newCanvas() {
We will fordward the event to whoever is
controlling the editor.
*/
window.editorController.onKeyDown(event)
if (window.editorController !== undefined) {
window.editorController.onKeyDown(event)
}
return
}
/* When the Docs is Visible, we do not process key down events of the Designer Space. */
+41 -14
View File
@@ -6,7 +6,7 @@ function newEventsServerClient(networkNode) {
const ERROR_LOG = true
const INFO_LOG = true
const logger = newWebDebugLog()
let WEB_SOCKETS_CONNECTION
@@ -27,7 +27,7 @@ function newEventsServerClient(networkNode) {
let commandsWaitingConfirmation = new Map()
let commandsSentByTimestamp = new Map()
let nonce = 0
let lastTryToReconnectDatetime
let lastTryToReconnectDatetime
return thisObject
@@ -54,7 +54,7 @@ function newEventsServerClient(networkNode) {
if (WEB_SOCKETS_CONNECTION !== undefined) {
if (WEB_SOCKETS_CONNECTION.readyState === 1) {
return true
}
}
}
}
@@ -76,7 +76,7 @@ function newEventsServerClient(networkNode) {
}
function sendToWebSocketServer(command) {
if (commandsWaitingConfirmation === undefined) {return} // object already finalized
if (commandsWaitingConfirmation === undefined) { return } // object already finalized
nonce++
let stringNonce = nonce.toString()
@@ -162,7 +162,7 @@ function newEventsServerClient(networkNode) {
function physics() {
if (WEB_SOCKETS_CONNECTION !== undefined) {
if (WEB_SOCKETS_CONNECTION.readyState === 3) {
if (WEB_SOCKETS_CONNECTION.readyState === 3) {
/*
Connection closed. May happen after computer goes to sleep.
We will try to reconnect, but we will do it no more that once
@@ -177,7 +177,7 @@ function newEventsServerClient(networkNode) {
setuptWebSockets(onOpen)
}
}
function onOpen() {
if (INFO_LOG === true) { logger.write('[INFO] setuptWebSockets -> Found Web Sockets Connection Closed. Reconnected to WebSockets Server.') }
}
@@ -190,8 +190,8 @@ function newEventsServerClient(networkNode) {
setuptWebSockets(onOpen)
}
if (thisObject.isConnected() !== true ) {
if ( lastTryToReconnectDatetime !== undefined) {
if (thisObject.isConnected() !== true) {
if (lastTryToReconnectDatetime !== undefined) {
if (networkNode !== undefined) {
if (networkNode.payload !== undefined) {
if (networkNode.payload.uiObject !== undefined) {
@@ -206,8 +206,8 @@ function newEventsServerClient(networkNode) {
if (networkNode.payload.uiObject !== undefined) {
networkNode.payload.uiObject.setStatus('Connected to Superalgos Client via WebSockets.')
retryCommandsPhysics()
}
}
}
}
}
}
@@ -225,19 +225,46 @@ function newEventsServerClient(networkNode) {
port = config.webSocketsPort
/* Check if we really have to stablish the connection. */
if (config.autoConnect === false) {return}
if (config.autoConnect === false) { return }
} catch (err) {
networkNode.payload.uiObject.setErrorMessage('Bad configuration. Cannot know the host name or the webSocketsPort.')
networkNode.payload.uiObject.setErrorMessage(
'Bad configuration. Invalid JSON Format.',
undefined,
{
project: 'Superalgos',
category: 'Topic',
type: 'UI Websockets Error - Bad Configuration',
anchor: 'Invalid JSON Format'
}
)
return
}
if (host === undefined) {
networkNode.payload.uiObject.setErrorMessage('Bad configuration. You need to have a host property.')
networkNode.payload.uiObject.setErrorMessage(
'Bad configuration. Host Property Not Found.',
undefined,
{
project: 'Superalgos',
category: 'Topic',
type: 'UI Websockets Error - Bad Configuration',
anchor: 'Host Property Not Found'
}
)
return
}
if (port === undefined) {
networkNode.payload.uiObject.setErrorMessage('Bad configuration. You need to have a webSocketsPort property.')
networkNode.payload.uiObject.setErrorMessage(
'Bad configuration. WebSocketsPort Property Not Found.',
undefined,
{
project: 'Superalgos',
category: 'Topic',
type: 'UI Websockets Error - Bad Configuration',
anchor: 'WebSocketsPort Property Not Found'
}
)
return
}