Skip to content
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

Enable and Disable ping/pong #699

Closed
anishlg opened this issue Apr 25, 2018 · 8 comments
Closed

Enable and Disable ping/pong #699

anishlg opened this issue Apr 25, 2018 · 8 comments

Comments

@anishlg
Copy link

anishlg commented Apr 25, 2018

Expected Behavior

The ping/pong is enabled to identify the lost connection. For connection to work properly in Android mobile sleep mode, we should be able to disable ping/pong in sleep mode and enable it back again when device wakes up.

Current Behavior

In Android mobile goes to sleep mode, when we disable ping/pong using setConnectionLostTimeout(0). It works fine. But when we enable ping/pong (when device wakes up) using setConnectionLostTimeout(30), it does not work. When we checked, we find that the timer is destroyed on setConnectionLostTimeout(0). We expect it to be created and set on setConnectionLostTimeout(30). But it does not happen. Because of this, we don't have any method of enabling ping/pong once it is disabled.

Expected Solution

Currently disabling the ping/pong by setConnectionLostTimeout(0) is working. Library has to make the necessary changes to ensure ping/pong is enabled back when setConnectionLostTimeout(30) is called.
(or) If Library adds 2 separate methods to enable and disable ping/pong, that will be even better.
.

Steps to Reproduce (for bugs)

  1. Use the lib to create the android client app
  2. Connect with websocket server.
  3. Enable ping/pong in android app
  4. Set setConnectionLostTimeout(0) in android device sleep mode
  5. Set setConnectionLostTimeout(30) when android device waked up
  6. Put android device in sleep mode - the ping/pong disabled due to setConnectionLostTimeout(0)
  7. Put android in normal mode - the ping/pong didn't enabled event after setConnectionLostTimeout(30). From debug identified the timer is already destroyed.

Debug log (for bugs)

Context

Your Environment

  • Java-WebSocket:1.3.7
  • Java version: 1.8
  • Operating System and version: Android 8.1
  • Endpoint Name and version:
  • Link to your project:
@marci4
Copy link
Collaborator

marci4 commented Apr 26, 2018

Hello @anishlg,

thank you very much for opening this issue!

What do you think is the better approach? I am in favour of adding the possibility to reactivate the lost connection detection with the setter rather then adding an additional method.

Could you also provide a simple application for me since I haven't done any android app.

Thank you very much!

Best regards,
marci4

@anishlg
Copy link
Author

anishlg commented May 3, 2018

@marci4 ,
We create an android sample app for the issue testing. Please use this attached apk and connect to any webSocket server with ping/pong.
Instructions are provided in the attached ppt. Follow the same to reproduce the issue and please let us know any further queries...

android.zip

Best regards,
Anish

@Adezking
Copy link

Adezking commented May 8, 2018

Hello @anish,
I don't know much about programming and I've been finding it difficult to build my own Binary.com webSocket API connection system.
Pls I'll be willing to pay for your service if you can help me build for PC and mobile.My email is..

Adezking2007@gmail.com

THANKS.

@anishlg
Copy link
Author

anishlg commented May 11, 2018

@marci4 ,
Any update on this issue. we already shared the android app which can reproduce the issue. please revert with your suggestions for the same. If any clarification required, please let me know

Regards,
Anish

@marci4
Copy link
Collaborator

marci4 commented May 11, 2018

Hello @anishlg,
Sorry for not responding to use. Right now I am very busy and forgot to answer you.

I wrote the code and did not have this use case in mind (since this library is designed for java in the first place).
I just asked for the code to get a better understanding what is the best approach.
Never the less I cannot promise that I can integrate this feature soon since I am busy right now with a lot of work.

Best regards,
marci4

marci4 added a commit to marci4/Java-WebSocket-Dev that referenced this issue May 14, 2018
@marci4
Copy link
Collaborator

marci4 commented May 14, 2018

Hello @anishlg,
this issue should be solved with #708.

Could you maybe try it out?
Thank you!

Best regards,
marci4

@Gillardo
Copy link

Any idea when this will be available?

@marci4
Copy link
Collaborator

marci4 commented Jul 6, 2018

This issue is already in the master!

Closing it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants