-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve lost connection detection #473
Comments
Looking for some input here! I implemented a check with a timer. Check out the code here Did I miss something? Greetings |
Hello @marci4
So it's necessary to check whether the corresponding pong was received within a certain amount of time. But this would bring more pressure to server when there are plenty of clients. |
Thx for your input @zhoulifu :) This will add a bit more pressure but I think it is fine, especially since you have the possibility to turn it off. Greetings |
Ok I added a check for the pong response. Default check interval is 30 seconds, is this to often? Could you please check if for you this is working as well? Greetings |
Hey @marci4, i've tested it and it works 👍 |
Hello @zhoulifu, Greetings |
Merged changes into master branch. Changed timeout check to 60 seconds. Closing issue. |
Could you create an example that uses this lost detection connection? Im trying to follow the wiki and My Server that extends WebSocketServer doesn't recognize the method myServer.setConnectionLostTimeout(15). The wiki is pretty short so I'm not exactly sure where I'm going wrong. Im using 1.3.3 |
Lost connection is not yet released as a jar. It will come with the version 1.3.4 (no release date planned sorry) You can also use the master branch which already includes the lost connection detection! Do you have any idea how I can extend the wiki? Greetings |
Thanks for the quick reply, maybe examples on what methods to call in the js client and what methods in the server and to put it all in an example. Even if 1.3.4 was released the wiki is unfortunately so short I would not have understood the example(The same with trying to do wss, had alot of problems trying to make that work. As for me, Im forced to use 1.3.3 for now, so Im trying to implement the ping/pong thing myself. What is not clear for me from the wiki what ping and pong are exactly, strings, objects etc? also some kind of interaction diagram would be handy. So right now im unsure what to send to the client from the server and what method to use. Im guessing I could use websocket.send(String) but maybe thats not ideal because of the overhead. Greetings, |
Im using a javascript client and am wondering how to check for pings from a server in a regular interval there. Did you use JS also and have found a solution? JS does not appear to have multithreading Greetings, |
Hello @qhchen2, I am gonna extend the wiki a bit more then (Sorry, for me these things are pretty clear ;) ) Let me explain some stuff for you! Greetings |
Hey marci, just a quick question on some code I found in AbstractWebSocket class in the master, namely /**
Is this your code that is not part of 1.3.3, or is it code that has been part of the project for a long time? cause now it seems I can just use these builtin functions and variables to make the pingpong work. Greetings, |
Hello @qhchen2, the code is part of my connection lost detection! Greetings |
@marci4 on Android Client: Request is done from android webview level web-socket as client. but after webview is frozen it fails to send pong. Server: say if server is setConnectionLostTimeout(30secs), Server will auto detect and wait for message from client? Client has to retry to the same server port? Thanks |
E.g. using this lib on a smartphone, you may lose the connection.
Related issues:
#471
#180
The text was updated successfully, but these errors were encountered: