Hi,
i think _msgid is created by node-red nodes even if if you dont define it to differentiate as to what node sent the message.
question : why to modify the _msgid and not create a new object property for your use ?
let myMsg = {};
for(let i=0; i < 10; i++) {
myMsg = {myid: i, payload: "foo", topic: "bar" }
node.send(myMsg);
}
Example
[{"id":"3defa83a.e933d","type":"inject","z":"2990ba34.3b9c8e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":310,"y":400,"wires":[["fcbee6d9.61b95"]]},{"id":"fcbee6d9.61b95","type":"function","z":"2990ba34.3b9c8e","name":"","func":"let myMsg = {};\n\nfor(let i=0; i < 10; i++) {\n \n myMsg = {myid: i, payload: \"foo\", topic: \"bar\" }\n node.send(myMsg);\n}\n\n\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":550,"y":420,"wires":[["8049644e.83ee08"]]},{"id":"8049644e.83ee08","type":"debug","z":"2990ba34.3b9c8e","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":740,"y":420,"wires":[]}]