Open arnehaber opened 4 years ago
Hi Arne,
Thanks for your question. I'm curious, are you Scandinavian?
Sorry I didn't reply earlier, just saw your issue now. The ping (which they call hearthbeat) function is obsolete with the websocket, since a socket has linkstate functionality build in. If I remember correctly, OCA made Heartbeat optional in OCPP 1.6-j and I guess it's gone in 2.0.
Wait are you asking if the websocket component ai use can be reconfigured? I would have to investigate that.
Sincerely, Thomas
Hi Thomas,
no, I'm not Scandinavian, just my name is ;)
I do not mean the OCPP heartbeat message, I was writing about the websocket ping. Please see "Open Charge Point Protocol JSON 1.6, OCPP-J 1.6 Specification" chapter "5.3. WebSocket Ping in relation to OCPP Heartbeat". According to the 1.6 JSON Spec, the OCPP heartbeat SHALL still be used for time synchronization (once a day). The "is alive" function is given by the built in Ping and Pong frames from the WebSocket specification. This (client) library does not seem to send pings to a connected (via ws) ocpp server. So my question is, how to enable web socket pings and how can I configure the interval.
Best, Arne
Hi Arne,
Well it sure looks like the lib I use can send ping messages. The websocket client appears to have a SendPing method, but I'll have to think about how to work it in. What do you think? Should the client send a ping message at a configurable interval with it's own internal timer? Or should the implementer (you) be able to write their own ping rutine?
Hi Thomas,
I would suggest a "setPingInterval" in the JSONClient which controls the internal behavior.
According to "Open Charge Point Protocol JSON 1.6, OCPP-J 1.6 Specification" chapter "7. Configuration", the configuration key "WebSocketPingInterval" can be used by the implementer to control the timer by using the "setPingInterval" method.
Best, Arne
@arnehaber: That's already implemented. See https://github.com/ChargeTimeEU/Java-OCA-OCPP/blob/master/OCPP-J/src/main/java/eu/chargetime/ocpp/JSONConfiguration.java
JSONConfiguration.get().setParameter(PING_INTERVAL_PARAMETER, pingInterval) builds a configuration with the given pingInterval, which you then pass into the JSONClient constructor. Voilá!
@robert-s-ubi well voila ... a simple reconnect is not possible. One has to reboot the system to adjust the WebSocketPingInterval. Not only that, the WebSocketPingInterval has to be persisted in order to "survive" a reboot.
@robert-s-ubi well voila ... a simple reconnect is not possible. One has to reboot the system to adjust the WebSocketPingInterval. Not only that, the WebSocketPingInterval has to be persisted in order to "survive" a reboot.
How do you get to these conclusions? This is just a library, it has no concept of "rebooting". The maximum "reset" within its scope would be stopping the JAVA VM and starting a new one. If you have this library running on a system which indeed requires a reboot to change the WebSocket ping interval, then you have some weird issue with the system, but not with the library itself.
Hi,
is it possible to configure websocket pings for the current JSONClient?
I found some related code here but it seems to be removed for the most current version,
Best, Arne