Comments (2)
Hi,
more documentation is very welcome.
- you are correct, no queued, and the return value indecates if somthing is send.
- yes webSocket.loop is calling webSocket.onEvent (unless tcp async is used)
the call stack look like this:
arduinoWebSockets/src/WebSocketsClient.h
Lines 162 to 166 in 30d5e13
arduinoWebSockets/src/WebSocketsClient.cpp
Lines 467 to 469 in 30d5e13
arduinoWebSockets/src/WebSockets.cpp
Line 468 in 30d5e13
arduinoWebSockets/src/WebSockets.cpp
Lines 462 to 465 in 30d5e13
arduinoWebSockets/src/WebSockets.cpp
Line 341 in 30d5e13
arduinoWebSockets/src/WebSocketsClient.cpp
Line 558 in 30d5e13
arduinoWebSockets/src/WebSocketsClient.cpp
Line 202 in 30d5e13
from arduinowebsockets.
Alright, I'll work on some documentation. I'll also link issues here as long as I find some.
I'll write in doc for now that this is safe to just call websocket.loop()
in the loop. As the send method is only doing a skip and false.
Also, the user can implement queuing on its own if desired.
Here is my current implementation of sending, which just skip with a message printed.
void serializeAndSend(WebSocketsClient &webSocket, const JsonDocument &document)
{
// Serialize the JSON document to a String
String jsonString;
serializeJson(document, jsonString);
// Send the JSON message to the WebSocket server
#ifdef DEBUG
const bool isSent = webSocket.sendTXT(jsonString);
Serial.print("📥 OUT - ");
if (isSent)
Serial.println(jsonString);
else
Serial.println("Not connected… Skipped!");
#else
webSocket.sendTXT(jsonString);
#endif
}
from arduinowebsockets.
Related Issues (20)
- WebSocket with AT commands (GSM model: Quectel EC25)
- Async with Socket.IO disconnects and reconnects repeatedly HOT 1
- Conflict when using with pn532. HOT 2
- WebSocketsClient - Return in Void-Function and also toString not found? HOT 3
- Connecting as a client to another ESP8266 hosting Async websocket server is failing on long messages. HOT 1
- Serial Monitor Garbage datas
- Disconnection detection issue HOT 11
- The error code is not compiled: 'class WiFiServer' does not have a member named 'accept' HOT 4
- Cannot connect to Socket.IO serve HOT 1
- Can't find WiFi.h and WiFiClientSecure.h HOT 2
- ESP32 + ENC28J60 = tcpip_send_msg_wait_sem HOT 1
- Compilation error: exit status 1
- Sadly it's crashing all over the place
- Clinet Suddenly not responding
- Receive BINARY_EVENT on ESP32 Socket.IO client
- esp32 wss disconnects randomly with errors
- ATMEGA websockets failing on server with bad mask
- If I put a delay in the loop, it stopped connecting to the server HOT 1
- examples/esp8266_pico/WebSocketServer example does not work on PicoW
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from arduinowebsockets.