quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.82k stars 2.69k forks source link

websocket extension should implement ping/pong #31157

Closed edeandrea closed 9 months ago

edeandrea commented 1 year ago

Description

The WebSocket API provides the ability to have pings and pongs, which allow a websocket connection to be kept alive between clients and servers.

Currently the Quarkus Websocket extension does not help with any of this. I would argue that implementing the pong on the server-side would be something common that every websocket server would want to do, hence I am proposing that the Quarkus Websocket extension should do this for the user automatically. Similarly on the WebSocket client, I would think anyone using Quarkus as a Websocket client would want/need this functionality out of the box.

It just seems like the right thing to do. Other frameworks (like SockJS for example) do this for their users.

Additionally, we would need to document how to use it. I can certainly see a situation where a user may use Quarkus as a back-end service and want the functionality server-side, but may need to manually implement the client side in the browser.

Implementation ideas

Maybe, for backwards compatibility, it is initially turned off & can be enabled via a configuration property (both client & server side)?

edeandrea commented 9 months ago

Was this really implemented? I see in #38745 all that was done was that there was a test added. Does this mean that the server-side implementation will automatically handle the ping messages and reply with a pong? The client just needs to send the ping to the server?