-
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
How to send customized ping message on connectionLostTimeout interval #941
Comments
Hello @gharia, that is currently not possible! Best regards, |
Hello @marci4, I hope you are well and sorry that I wasn't active for a looong time. I would like to start helping again by giving this issue a go, if that's okay ? |
Hello @haruntuncay, doing well, hope you are doing good? Of course, feel free :) Best regards, |
@marci4, Can I ask for your advice on something via email ? |
@haruntuncay always! :) |
Hello @gharia |
Thanks @haruntuncay for looking into it. If possible I would like to send the ping frame "with data" as described in the issue details. ould you point to me an example if any? |
@gharia, Currently, there isn't any way to set ping frame data, but I'm currently giving it a go. I would probably be able to submit a PR for review in 1-2 days. |
@marci4, @gharia, I am uncertain regarding the functionality here. Would support for String data only be enough, or should binary data also be supported ? Also, instead of overwriting |
@haruntuncay I think support for String data is good enough in case of ping, at least from my perspective. It would be rare if someone wants to send binary data frames along with PING. Re:
|
|
@haruntuncay I would not limit the data to Strings. Maybe extending the WebSocketListener/WebSocketAdapter and providing a default implementation for something like Then sendPing will call onPreparePing() (we have to remove the cached ping frame then). |
Describe what you would like to know or do
How to send a custom Ping message on
connectionLostTimeout
?Describe the solution you'd considered
For creating a WS client, I am extending
WebSocketClient
. I didsetConnectionLostTimeout
to 30 seconds. and override thesendPing()
methodJava-WebSocket/src/main/java/org/java_websocket/client/WebSocketClient.java
Line 439 in a2c63db
I thought it would be simple, just to override
sendPing()
. But it is not the case. My overridden method never gets invoked. Rather it calls engine'ssendPing()
Java-WebSocket/src/main/java/org/java_websocket/WebSocketImpl.java
Line 661 in a2c63db
Additional context
It's not causing any connection close issue, but I am just looking for a way o customize the send ping message.
The text was updated successfully, but these errors were encountered: