diff --git a/src/main/java/com/dispose/config/UndertowPoolCustomizer.java b/src/main/java/com/dispose/config/UndertowPoolCustomizer.java new file mode 100644 index 00000000..db07f635 --- /dev/null +++ b/src/main/java/com/dispose/config/UndertowPoolCustomizer.java @@ -0,0 +1,30 @@ +package com.dispose.config; + +import io.undertow.server.DefaultByteBufferPool; +import io.undertow.websockets.jsr.WebSocketDeploymentInfo; +import org.springframework.boot.web.embedded.undertow.UndertowServletWebServerFactory; +import org.springframework.boot.web.server.WebServerFactoryCustomizer; +import org.springframework.stereotype.Component; + +/** + * The type Undertow pool customizer. + * + * @author + */ +@Component +public class UndertowPoolCustomizer implements WebServerFactoryCustomizer { + + /** + * Customize. + * + * @param factory the factory + */ + @Override + public void customize(UndertowServletWebServerFactory factory) { + factory.addDeploymentInfoCustomizers(deploymentInfo -> { + WebSocketDeploymentInfo webSocketDeploymentInfo = new WebSocketDeploymentInfo(); + webSocketDeploymentInfo.setBuffers(new DefaultByteBufferPool(false, 1024)); + deploymentInfo.addServletContextAttribute("io.undertow.websockets.jsr.WebSocketDeploymentInfo", webSocketDeploymentInfo); + }); + } +}