Comments (4)
Hi, the best way to check if a client is connected is by using:
if (client.available()) {
// Connected...
}
The best way to reconnect is to reset the object (by assinging a new instance) and setting up the callbacks again. So for example:
if (client.available()) {
// Connected, do something...
} else {
client = WebsocketsClient();
client.onMessage(...);
client.onEvent(...);
client.connect(...);
}
from arduinowebsockets.
Hi, the best way to check if a client is connected is by using:
if (client.available()) { // Connected... }The best way to reconnect is to reset the object (by assinging a new instance) and setting up the callbacks again. So for example:
if (client.available()) { // Connected, do something... } else { client = WebsocketsClient(); client.onMessage(...); client.onEvent(...); client.connect(...); }
this is what i was looking for ....... however it is an excellent library, a great job.
thank you
from arduinowebsockets.
I consider this issue resolved. If you have any other queshtions please share, otherwise I will close this issue due to inactivity.
from arduinowebsockets.
Resolved.
from arduinowebsockets.
Related Issues (20)
- question of example
- Websocket Client Became Slower and Unstable After Upgrading ESP32 from 1.0.4 to 1.0.6 HOT 1
- Websocket server memory leak
- Can we get a documentation/wiki? HOT 1
- where to find certificate Eg: echo_org_ssl_ca_cert[] HOT 1
- ESP32-Server Not Working Properly receives one msg and gets disconnected HOT 3
- How to know hostname and IP from client? HOT 1
- esp32 to wss python server
- ESP32 Websocket Client doesn't connect to Node.js Websocket server HOT 3
- poll() disconnects client HOT 7
- How to get a reference of the web socket client that dispatched the msg callback
- Hieromon/AutoConnect & WebSockets Client on ESP8266 - Can't Establish wss
- Secured-ESP8266-Client can't seem to receive any messages while connection is open HOT 1
- Compilation error: 'WebsocketsClient' does not name a type ?? HOT 3
- Getting a error from the TCPServer using the Arduino GIGA R1 WIFI on the ESP-32Client code. HOT 3
- ESP32-CAM WebSocket Server: Failure to Stream Camera Feed after Page Refresh or Multiple Connections
- WSS Connection error
- [ 5236][E][WiFiClient.cpp:313] setSocketOption(): fail on -1, errno: 9, "Bad file number" HOT 2
- Reconnecting after lost connection HOT 2
- Disconnecting almost inmediately
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.