Closed GowthamGottimukkala closed 4 years ago
I solved this by keeping my variable in quotes (like a string). Don't know if this is the right way.
String message = "";
message += "\"";
message += myvariable;
message += "\"";
socket.emit ("timestamp", message.c_str());
I am having trouble including variables in socket.emit(). My variable is
timeClient.getFormattedTime()
which returns a stringIf I use
socket.emit("timestamp", timeClient.getFormattedTime().c_str());
then my output is[SIoC] add packet 42["timestamp",01:19:25]
but I can't receive this in my server.I am receiving it only if the output is like below
[SIoC] add packet 42["timestamp","01:19:25"]
How should I do this?