Comments (11)
Hi @elC0mpa,
I think the issue is fixed now. It seems like Asyncwebserver
expects the whole websockets frame to come as one chunck, and I separate it for convince. This is not a "client bug" per se, but because changing it won't harm the correctness of the impl and will only increase compatibility with other versions and implementations of websockets - I'm happy to make it.
The changes are in master
, can you clone the repo (or pull the changes) and see if the issue is fixed for you as well?
Gil.
from arduinowebsockets.
As far as I tested, the library does handle the ping/pong situation. It does reply automatically with a pong every time receives a ping from the remote socket.
The server implementation you are using should reply with a pong to every ping request that is received from the micro-controller as well, if one is sent.
There's nothing that can be done on the library side, as it works accordingly.
See the RFCs here for details about how ping/pong frame is handled.
Perhaps you just have to configure your websocket server accordingly.
from arduinowebsockets.
@adelin-mcbsoft is absolutely right, the library will response with a pong
every time a ping
is received. The pong
content will be the same as the content passed in the ping
, as the RFC specifies.
Thanks for helping @adelin-mcbsoft.
The server I am using is from the Asyncwebserver library
Cool, I'll look into it tomorrow. Hopefully I will understand what is the issue (either in my or their impl). If I won't be able to reproduce using a Asyncwebserver
server, I will let you know so we can continue to try and find the issue.
from arduinowebsockets.
Great, I'm happy to help. I'll wait for your updates.
Actually not only pongs crash, any kind of message sent to the server used to crash it. So the change was essentially to how the library sends any kind of websockets message.
Gil.
from arduinowebsockets.
Great, I'll release it as a patch right now.
I agree, it is a great change and I'm glad you surfaced this issue.
Thanks,
Gil.
from arduinowebsockets.
Steps to reproduce the behavior.
I'm sorry but there isn't enough info for me to reproduce or solve anything here. As you can guess pings should and are working fine for most people who use the library.
What is the server you are using? (software)
ESP debug logs can also be super useful.
from arduinowebsockets.
Ok @gilmaimon, I understand you. Later i will post the code. The server I am using is from the Asyncwebserver library. I just want to know something, isn't supposed that each time the websocket receives a ping, it should respond with a pong? In that case, how can i do it, I mean, a pong. Have you think about sending the pong automatically?
from arduinowebsockets.
You both are entirely right @gilmaimon and @adelin-mcbsoft, the library sends automatically a pong when it receives a ping. But there is a problem, when server receives the pong from the websocketclient wich is written using this library, it crashes. In order to detect the problem i programmed to log everything that is happening through serial. The problem is that, after receiving the pong answer from the client, it receives a binary message : 6e. In order to detect if the problem is related to the server, I did the same but using this library https://github.com/Links2004/arduinoWebSockets. The thing is that in this case, the server doesn't crash. So there should be a difference between your pong implementation and theirs. I hope this could Help you improving your library if i am right, I would like to keep using your library. Thanks in advance
from arduinowebsockets.
I understand everything works well? @elC0mpa
from arduinowebsockets.
Thanks for your answer @gilmaimon, I really appreciate your Help by changing the pong functionality of this library, I am busy right now but later i will clone the master branch and i will tell you if everything works as expected.
from arduinowebsockets.
It worked as expected @gilmaimon, now the websocketclient doesn't disconnect from server because the server doesn't crash. Thanks for your support, I really appreciate it, and i think this issue has helped to improve the compatibility of the library, so it has been good for you too. Thanks again
from arduinowebsockets.
Related Issues (20)
- 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 10
- 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
- Random disconnects, fails on binary ping including 0x00 HOT 1
- Issue with WSS and ESP 32 HOT 4
- Esp32 WebSocket Client won't work with WebSocket Node.js server. HOT 3
- Client-Message-Buffer
- ESP32 Server disconnected when receiving messages HOT 1
- Compilation errors with arduino_esp32 version 3.0.0 HOT 6
- wrong username
- Project is dead
- network::TcpServer* _server HOT 1
- Getting my connection closed when on node js wss server HOT 4
- Esp8266-Client example compiles with warnings, maybe others do too. HOT 2
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.