My arduino socket client is working - both sending and receiving. The server side is NodeJS server on Raspberry Pi. I am missing some key point it appears.
I was expecting the payload to be a single string. I am not experienced programmer and need a nudge to get node and the socket client working together. I can see the string in the console followed by CR and "undefined". I cannot access the string.
My arduino socket client is working - both sending and receiving. The server side is NodeJS server on Raspberry Pi. I am missing some key point it appears.
Key Arduino lines: String msgString = "\"ESP_0001, 72, 29.30, 43\""; webSocket.emit("ESP", msgString.c_str());
Code compiles and executes as expected on ESP8266: [SIoC] packet "42["ESP","ESP_0001, 72, 29.30, 43"]" emitted
However, in Node JS the payload is undefined. I can see the data in console.log but I cannot access the data since it is undefined.
Key Node lines: socket.on('ESP', function(error, data) { //data from ESP module if (error) console.log(error); newString = (data + ":End").toString(); console.log(newString); });
Console.log output: ESP_0001, 72, 29.30, 43 undefined:End
I was expecting the payload to be a single string. I am not experienced programmer and need a nudge to get node and the socket client working together. I can see the string in the console followed by CR and "undefined". I cannot access the string.
Thanks.