Skip to content

Commit

Permalink
Update WebSocketClientSocketIOack.ino
Browse files Browse the repository at this point in the history
- fix some typos
  • Loading branch information
omarcostahamido authored Nov 16, 2024
1 parent 8cdcf47 commit daf04b0
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ void socketIOEvent(socketIOmessageType_t type, uint8_t * payload, size_t length)

// Message Includes a ID for a ACK (callback)
if(id) {
// creat JSON message for Socket.IO (ack)
// create JSON message for Socket.IO (ack)
DynamicJsonDocument docOut(1024);
JsonArray array = docOut.to<JsonArray>();

Expand Down Expand Up @@ -130,19 +130,19 @@ void loop() {
if(now - messageTimestamp > 2000) {
messageTimestamp = now;

// creat JSON message for Socket.IO (event)
// create JSON message for Socket.IO (event)
DynamicJsonDocument doc(1024);
JsonArray array = doc.to<JsonArray>();

// add evnet name
// add event name
// Hint: socket.on('event_name', ....
array.add("event_name");

// add payload (parameters) for the event
JsonObject param1 = array.createNestedObject();
param1["now"] = (uint32_t) now;

// JSON to String (serializion)
// JSON to String (serialization)
String output;
serializeJson(doc, output);

Expand Down

0 comments on commit daf04b0

Please sign in to comment.