8d99aa1235
### Motivation: Introduction of `WebSocketDecoderConfig` made our server-side code more elegant and simpler for support. However there is still some problem with maintenance and new features development for WebSocket codecs (`WebSocketServerProtocolHandler`, `WebSocketServerProtocolHandler`). Particularly, it makes me ~~crying with blood~~ extremely sad to add new parameter and yet another one constructor into these handlers, when I want to contribute new feature. ### Modification: I've extracted all parameters for client and server WebSocket handlers into config/builder structures, like it was made for decoders in PR #9116. ### Result: * Fixes #9698: Simplify WebSocket handlers constructor arguments hell * Unblock further development in this module (configurable close frame handling on server-side; automatic close-frame sending, when missed; memory leaks on protocol violations; etc...) Bonuses: * All defaults are gathered in one place and could be easily found/reused. * New API greatly simplifies usage, but does NOT allow inheritance or modification. * New API would simplify long-term maintenance of WebSockets module. ### Example WebSocketClientProtocolConfig config = WebSocketClientProtocolConfig.newBuilder() .webSocketUri("wss://localhost:8443/fx-spot") .subprotocol("trading") .handshakeTimeoutMillis(15000L) .build(); ctx.pipeline().addLast(new WebSocketClientProtocolHandler(config)); |
||
---|---|---|
.. | ||
main | ||
test |