Skip to content

Commit 1c53b53

Browse files
authored
Merge pull request #220 from ubitricity/master
Allow JSONClient reconfiguration when connected
2 parents b163057 + 365b42a commit 1c53b53

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

OCPP-J/src/main/java/eu/chargetime/ocpp/WebSocketTransmitter.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,9 @@ byte[] joinByteArrays(byte[] a, byte[] b) {
152152
}
153153

154154
void configure() {
155+
if (client == null) {
156+
return;
157+
}
155158
client.setReuseAddr(configuration.getParameter(JSONConfiguration.REUSE_ADDR_PARAMETER, false));
156159
client.setTcpNoDelay(
157160
configuration.getParameter(JSONConfiguration.TCP_NO_DELAY_PARAMETER, false));

ocpp-v1_6/src/main/java/eu/chargetime/ocpp/JSONClient.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,14 @@ public JSONClient enableWSS(WssSocketBuilder wssSocketBuilder) {
144144
return this;
145145
}
146146

147+
/**
148+
* Applies JSONConfiguration changes when already connected. Specifically, the WebSocket ping
149+
* interval can be changed without reconnecting by calling this method.
150+
*/
151+
public void reconfigure() {
152+
transmitter.configure();
153+
}
154+
147155
@Override
148156
public void addFeatureProfile(Profile profile) {
149157
featureRepository.addFeatureProfile(profile);

0 commit comments

Comments
 (0)