Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to send a JSON object through the ArduinoWebsockets #168

Open
KamalTolouiFard opened this issue Aug 31, 2024 · 0 comments
Open

How to send a JSON object through the ArduinoWebsockets #168

KamalTolouiFard opened this issue Aug 31, 2024 · 0 comments

Comments

@KamalTolouiFard
Copy link

hi

i need to send a JSON object to a host.
i was hopping i could use the ArduionJson library like :
serializeJson(doc,ws);

this is what i came up with till now:
size_t length = measureJson(doc) + 1;
char * msg = (char *) calloc(1, length);
serializeJson(doc,msg,length);
ws.send(msg);
free(msg);

as you can see it is not very elegant.
any suggestions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant