- Sat May 12, 2018 8:34 pm
#75905
I am a bit further down the track with this project. I have a working websockets connection and am able to control the stepper motor from the client.
The ESP server receives a command from the client and broadcasts a text string to all clients in return as confirmation.
My next problem is, after receiving data from a client I need to broadcast that data back to all clients.
It sounds simple enough but I seem to be unable to come to grips with the relationship between byte, payload, array, sizeof, length, blob, etc.
What I have on the ESP server to broadcast the data: (Data does not exceed 300).
Code: Select all uint8_t payload[] = {0,0};
payload[0] = setpointVariable;
payload[1] = targetGroundSpeed;
webSocket.broadcastBIN(payload, sizeof(payload));
And what I see in the Chrome developer tools console:
Code: Select allBlob(2) {size: 2, type: ""}
size:2
type:""
__proto__:Blob
size:(...)
slice:ƒ slice()
type:(...)
constructor:ƒ Blob()
Symbol(Symbol.toStringTag):"Blob"
get size:ƒ ()
get type:ƒ ()
__proto__:Object
Despite reading all sorts of references from google, I still don't seem to know what I am doing.
If anyone can point me in the direction of a good tutorial I would appreciate it.
If anyone wants to have a go at helping me with the code, I would really really appreciate it.