Skip to content

Commit 8a7baac

Browse files
authored
Merge pull request #1845 from steve-community/1844-regression-websocket-connections-close-after-30-secs
make DefaultHandshakeHandler a bean (#1844)
2 parents a2ff8a6 + c643bfe commit 8a7baac

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/main/java/de/rwth/idsg/steve/config/WebSocketConfiguration.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import lombok.RequiredArgsConstructor;
2929
import lombok.extern.slf4j.Slf4j;
3030
import org.eclipse.jetty.websocket.core.WebSocketConstants;
31+
import org.springframework.context.annotation.Bean;
3132
import org.springframework.context.annotation.Configuration;
3233
import org.springframework.web.socket.config.annotation.EnableWebSocket;
3334
import org.springframework.web.socket.config.annotation.WebSocketConfigurer;
@@ -62,7 +63,7 @@ public class WebSocketConfiguration implements WebSocketConfigurer {
6263
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
6364
OcppWebSocketHandshakeHandler handshakeHandler = new OcppWebSocketHandshakeHandler(
6465
chargeBoxIdValidator,
65-
defaultHandshakeHandler(),
66+
handshakeHandler(),
6667
Lists.newArrayList(ocpp16WebSocketEndpoint, ocpp15WebSocketEndpoint, ocpp12WebSocketEndpoint),
6768
chargePointRegistrationService
6869
);
@@ -77,7 +78,8 @@ public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
7778
*
7879
* Otherwise, defaults come from {@link WebSocketConstants}
7980
*/
80-
private static DefaultHandshakeHandler defaultHandshakeHandler() {
81+
@Bean
82+
public DefaultHandshakeHandler handshakeHandler() {
8183
JettyRequestUpgradeStrategy strategy = new JettyRequestUpgradeStrategy();
8284

8385
strategy.addWebSocketConfigurer(configurable -> {

0 commit comments

Comments
 (0)