gilmaimon / ArduinoWebsockets

A library for writing modern websockets applications with Arduino (ESP8266 and ESP32)
GNU General Public License v3.0
482 stars 97 forks source link

emit/send event with data #102

Open Raul-Altamirano opened 3 years ago

Raul-Altamirano commented 3 years ago

Someone please can tell me o explain me how can i do this using this library?

socket.emit ( " jsonObject " , " { \" foo \ " : \" bar \ " } " );

I would like to emit a event to my server express (nodejs), but sending some data like a JSON.

Thanks in advance

gilmaimon commented 3 years ago

Hi :)

You can use the examples, they will show you how to send data using the library... Other than that, you can create the JSON using an Arduino JSON library or just by concatenating strings and then sending it normally over the websocket..