Here is my example using node-red-contrib-queue-gate
using url parameters to start and stop updating of a timestamp.
Start - http://yourip:1880/nr-help-timestamp?action=start
If you refresh the page the timestamp will change every 5 seconds
Stop - http://yourip:1880/nr-help-timestamp?action=stop
when you refresh the page the timestamp will remain the same
[
{
"id": "839ddaad8d0899de",
"type": "inject",
"z": "c272682f840e082e",
"name": "",
"props": [
{
"p": "timestamp",
"v": "",
"vt": "date"
}
],
"repeat": "5",
"crontab": "",
"once": true,
"onceDelay": 0.1,
"topic": "",
"x": 650,
"y": 100,
"wires": [
[
"553fd81486ef7866"
]
]
},
{
"id": "402eea59f3ef5733",
"type": "change",
"z": "c272682f840e082e",
"name": "",
"rules": [
{
"t": "set",
"p": "nr_help_timestamp",
"pt": "flow",
"to": "timestamp",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1040,
"y": 140,
"wires": [
[]
]
},
{
"id": "3de4a4d8269e31f2",
"type": "http in",
"z": "c272682f840e082e",
"name": "",
"url": "/nr-help-timestamp",
"method": "get",
"upload": false,
"swaggerDoc": "",
"x": 200,
"y": 180,
"wires": [
[
"2c7eecc2f2d6f0e7",
"03bc98d66492f823",
"0cdfd60ecbdef030"
]
]
},
{
"id": "553fd81486ef7866",
"type": "q-gate",
"z": "c272682f840e082e",
"name": "",
"controlTopic": "control",
"defaultState": "open",
"openCmd": "open",
"closeCmd": "close",
"toggleCmd": "toggle",
"queueCmd": "queue",
"defaultCmd": "default",
"triggerCmd": "trigger",
"flushCmd": "flush",
"resetCmd": "reset",
"peekCmd": "peek",
"dropCmd": "drop",
"statusCmd": "status",
"maxQueueLength": "100",
"keepNewest": false,
"qToggle": false,
"persist": false,
"storeName": "memory",
"x": 830,
"y": 140,
"wires": [
[
"402eea59f3ef5733"
]
]
},
{
"id": "1c18c01330c5be67",
"type": "function",
"z": "c272682f840e082e",
"name": "headders, paylod and status code",
"func": "msg.statusCode = \"200\";\nmsg.headers = {};\nmsg.headers['X-Robots-Tag'] = \"noindex\";\nmsg.headers['content-type'] = 'text/html';\n\n\nreturn msg;\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 700,
"y": 240,
"wires": [
[
"a13ecdd84523da3b"
]
]
},
{
"id": "a13ecdd84523da3b",
"type": "http response",
"z": "c272682f840e082e",
"name": "",
"statusCode": "",
"headers": {},
"x": 930,
"y": 240,
"wires": []
},
{
"id": "2c7eecc2f2d6f0e7",
"type": "debug",
"z": "c272682f840e082e",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 410,
"y": 200,
"wires": []
},
{
"id": "0cdfd60ecbdef030",
"type": "change",
"z": "c272682f840e082e",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "nr_help_timestamp",
"tot": "flow"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 440,
"y": 240,
"wires": [
[
"1c18c01330c5be67"
]
]
},
{
"id": "03bc98d66492f823",
"type": "switch",
"z": "c272682f840e082e",
"name": "",
"property": "payload.action",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "start",
"vt": "str"
},
{
"t": "eq",
"v": "stop",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 410,
"y": 160,
"wires": [
[
"95f2702c1e79dfa3"
],
[
"8cfba2cb0cb70f38"
]
]
},
{
"id": "95f2702c1e79dfa3",
"type": "change",
"z": "c272682f840e082e",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "open",
"tot": "str"
},
{
"t": "set",
"p": "topic",
"pt": "msg",
"to": "control",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 620,
"y": 140,
"wires": [
[
"553fd81486ef7866"
]
]
},
{
"id": "8cfba2cb0cb70f38",
"type": "change",
"z": "c272682f840e082e",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "close",
"tot": "str"
},
{
"t": "set",
"p": "topic",
"pt": "msg",
"to": "control",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 620,
"y": 180,
"wires": [
[
"553fd81486ef7866"
]
]
}
]