Hello community:

This is a discussion on whether to reuse HttpClient 
for WebSocketPluginConfiguration.



current WebSocketPluginConfiguration:


    @Bean
    public ReactorNettyWebSocketClient 
reactorNettyWebSocketClient(final ShenyuConfig shenyuConfig) {
        final ReactorNettyWebSocketClient webSocketClient = 
new ReactorNettyWebSocketClient();
        
webSocketClient.setMaxFramePayloadLength(shenyuConfig.getWebsocket().getMaxFramePayloadSize()
 * 1024 * 1024);
        return webSocketClient;
    }


after reuse HttpClient in HttpClientPluginConfiguration:


    @Bean
    public ReactorNettyWebSocketClient 
reactorNettyWebSocketClient(final ShenyuConfig shenyuConfig,
                      
                      
                      
&nbsp;final ObjectProvider<HttpClient&gt; httpClient) {
&nbsp; &nbsp; &nbsp; &nbsp; final ReactorNettyWebSocketClient webSocketClient = 
new ReactorNettyWebSocketClient(httpClient.getIfAvailable(HttpClient::create));
&nbsp; &nbsp; &nbsp; &nbsp; 
webSocketClient.setMaxFramePayloadLength(shenyuConfig.getWebsocket().getMaxFramePayloadSize()
 * 1024 * 1024);
&nbsp; &nbsp; &nbsp; &nbsp; return webSocketClient;
&nbsp; &nbsp; }


I think reuse could be better, how do you guys feel ?



Looking forward to your reply.
dragon-zhang

Reply via email to