Skip to content

How to send a JSON object through the ArduinoWebsockets #168

@KamalTolouiFard

Description

@KamalTolouiFard

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions