Open mrb-twx opened 7 years ago
would you mind to contribute such feature ?
Sure, I'll take a look at it.
@vietj if you share some pointers I may be able to contribute the patch. Not being able to set idle timeout at the websocket level is problematic. If we set the HTTP timeout too high, let's sat 30s/60s we can potentially have lingering HTTP connections and that may turn into a scalability issue. If we set the timeout too low, we are forced to send pings or heartbeats over websocket which would translate in unnecessary traffic.
how does the code decide when the timeout should be changed ?
@vietj I don't know if Netty has a way to differentiate a regular HTTP connection from a Websocket one but one way I can think of this could be done is based on HTTP headers, if the request has the upgrade request the "setWebSocketIdleTimeout" applies.
I see now indeed it could be done after the upgrade
@vietj thank you for adding to the roadmap!
It would be useful if Vert.x permitted the idle timeout to be set on a per WebSocket basis.
Currently, the idle timeout for a server WebSocket can only be set via io.vertx.core.http.HttpServerOptions#setIdleTimeout, but because this is an HTTP server option it applies to all server WebSockets. This prevents someone from specifying different WebSocket idle timeouts based on things like the URI, path, or headers.