1919package de .rwth .idsg .steve .config ;
2020
2121import com .google .common .collect .Lists ;
22+ import de .rwth .idsg .steve .SteveConfiguration ;
2223import de .rwth .idsg .steve .ocpp .ws .OcppWebSocketHandshakeHandler ;
2324import de .rwth .idsg .steve .ocpp .ws .ocpp12 .Ocpp12WebSocketEndpoint ;
2425import de .rwth .idsg .steve .ocpp .ws .ocpp15 .Ocpp15WebSocketEndpoint ;
4546@ RequiredArgsConstructor
4647public class OcppWebSocketConfiguration implements WebSocketConfigurer {
4748
48- public static final String PATH_INFIX = "/websocket/CentralSystemService/" ;
49- public static final Duration PING_INTERVAL = Duration .ofMinutes (15 );
50- public static final Duration IDLE_TIMEOUT = Duration .ofHours (2 );
51- public static final int MAX_MSG_SIZE = 8_388_608 ; // 8 MB for max message size
49+ public static final Duration WS_PING_INTERVAL = Duration .ofMinutes (15 );
50+ public static final Duration WS_IDLE_TIMEOUT = Duration .ofHours (2 );
51+ public static final int WS_MAX_MSG_SIZE = 8_388_608 ; // 8 MB for max message size
5252
5353 private final ChargePointRegistrationService chargePointRegistrationService ;
5454 private final ChargeBoxIdValidator chargeBoxIdValidator ;
55+ private final SteveConfiguration config ;
5556
5657 private final Ocpp12WebSocketEndpoint ocpp12WebSocketEndpoint ;
5758 private final Ocpp15WebSocketEndpoint ocpp15WebSocketEndpoint ;
@@ -60,13 +61,16 @@ public class OcppWebSocketConfiguration implements WebSocketConfigurer {
6061 @ Override
6162 public void registerWebSocketHandlers (WebSocketHandlerRegistry registry ) {
6263
63- OcppWebSocketHandshakeHandler handshakeHandler = new OcppWebSocketHandshakeHandler (
64+ var handshakeHandler = new OcppWebSocketHandshakeHandler (
6465 chargeBoxIdValidator ,
6566 new DefaultHandshakeHandler (),
6667 Lists .newArrayList (ocpp16WebSocketEndpoint , ocpp15WebSocketEndpoint , ocpp12WebSocketEndpoint ),
67- chargePointRegistrationService );
68+ chargePointRegistrationService ,
69+ config .getPaths ().getWsPathInfix () + "/" );
6870
69- registry .addHandler (handshakeHandler .getDummyWebSocketHandler (), PATH_INFIX + "*" )
71+ registry .addHandler (
72+ handshakeHandler .getDummyWebSocketHandler (),
73+ config .getPaths ().getWsPathInfix () + "/*" )
7074 .setHandshakeHandler (handshakeHandler )
7175 .setAllowedOrigins ("*" );
7276 }
0 commit comments