-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Websocketclient disconnected from websocketserver #44
Comments
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) |
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? |
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. |
@adelin-mcbsoft is absolutely right, the library will response with a Thanks for helping @adelin-mcbsoft.
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 |
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 |
…agmented. This should solve issue #44. Also advanced to patch 0.4.12
Hi @elC0mpa, I think the issue is fixed now. It seems like The changes are in Gil. |
I understand everything works well? @elC0mpa |
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. |
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. |
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 |
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, |
Describe the bug
Websocketclient is disconnected from websocketserver after client get a ping from server
To Reproduce
Library : 0.4.11
Board : NodeMCU
Steps to reproduce the behavior.
Expected behavior
I just hope the client doesn't disconnect from server
Additional context
When this first happens, I thought it was because of a bug of the library, but i realized that the websocketserver makes a ping to the client when it receives a connection, so I decided to supress this behavior. After doing this, the websocketclient worked as expected, but i have no idea of what am i doing wrong. I suppose that i should modify the code when the client receives a Ping, something like answer with a pong, but i am not sure
The text was updated successfully, but these errors were encountered: