I have been stress-testing dashboard-2 nodes with big data messages, as discussed in Msg size limit in Dashboard 2.0 (messages beyond a certain size break the client connection).
I have now found out that the issue is not with the input msg size, but rather with the msg size of the node's response, emitted by this.send() (once I limit the response size, I am able to send big data arrays, with hundreds of thousands of elements, in a single message).
If my measurements are correct, responses bigger than ~825KB fail and break the client connection. Increasing apiMaxLength in settings.js, has no effect.
Am I missing any other setting here?
The issue is consistent and easy to simulate.
![]()
The template receives array dimensions, creates an array of objects, stringifies it (to enable measuring its size) and sends it using this.send(). For objects with 5 properties, an array up to 6980 elements (825KB) will go through, a bigger array crashes the socket connection (with no browser or server exception, other than the disconnect notification).
[
{
"id": "44b742873403c498",
"type": "inject",
"z": "f6d5b8d748838f68",
"name": "",
"props": [
{
"p": "maxRows",
"v": "6980",
"vt": "num"
},
{
"p": "maxProps",
"v": "5",
"vt": "num"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"x": 910,
"y": 580,
"wires": [
[
"e32e14cab9556887"
]
]
},
{
"id": "e32e14cab9556887",
"type": "ui-template",
"z": "f6d5b8d748838f68",
"group": "2bc9d878f96a3d0e",
"page": "",
"ui": "",
"name": "Create big response",
"order": 5,
"width": "8",
"height": "3",
"head": "",
"format": "<template>\n <div>\n Columns: {{msg.maxCols}}<br>\n Rows: {{msg.maxPros}}\n </div>\n</template>\n\n<script>\nconst $scope = this;\n\n// Socket listener\n$scope.$socket.on('msg-input:' + this.id, function(msg)\n{\n const rows = [];\n for (let i=0; i < msg.maxRows; i++)\n {\n const row = {id:i};\n for (let j = 1 ; j <= msg.maxProps ; j++)\n row[\"Prop\"+j] =\"DATA-\" + (i) + \"-\" + j;\n rows.push(row);\n }\n msg.payload=JSON.stringify(rows);\n msg.responseLength = \"\"+(msg.payload.length/1024).toFixed(2)+\"KB\";\n $scope.send(msg);\n});\n\n</script>\n",
"storeOutMessages": true,
"passthru": false,
"resendOnRefresh": true,
"templateScope": "local",
"className": "",
"x": 1100,
"y": 580,
"wires": [
[
"aa240d6ff17944eb"
]
]
},
{
"id": "aa240d6ff17944eb",
"type": "debug",
"z": "f6d5b8d748838f68",
"name": "debug 126",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1245,
"y": 580,
"wires": [],
"l": false
}
]