Skip to content

Commit 46d323e

Browse files
committed
[central system] Add websocket ping interval configuration
1 parent 228b1c9 commit 46d323e

File tree

4 files changed

+6
-1
lines changed

4 files changed

+6
-1
lines changed

examples/common/config/CentralSystemConfig.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ class CentralSystemConfig : public ocpp::config::ICentralSystemConfig
5151
std::string listenUrl() const override { return getString("ListenUrl"); }
5252
/** @brief Call request timeout */
5353
std::chrono::milliseconds callRequestTimeout() const override { return get<std::chrono::milliseconds>("CallRequestTimeout"); }
54+
/** @brief Websocket PING interval */
55+
std::chrono::seconds webSocketPingInterval() const override { return get<std::chrono::seconds>("WebSocketPingInterval"); }
5456
/** @brief Boot notification retry interval */
5557
std::chrono::seconds bootNotificationRetryInterval() const override
5658
{

examples/quick_start_centralsystem/config/quick_start_centralsystem.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ DatabasePath=./quick_start_centralsystem.db
33
JsonSchemasPath=../../schemas/ocpp16/
44
ListenUrl=ws://127.0.0.1:8180/steve/websocket/CentralSystemService/
55
CallRequestTimeout=2000
6+
WebSocketPingInterval=30
67
BootNotificationRetryInterval=30
78
HeartbeatInterval=3600
89
HttpBasicAuthent=false

src/centralsystem/CentralSystem.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ bool CentralSystem::start()
171171
credentials.client_certificate_authent = m_stack_config.tlsClientCertificateAuthent();
172172

173173
// Start listening
174-
ret = m_rpc_server->start(m_stack_config.listenUrl(), credentials);
174+
ret = m_rpc_server->start(m_stack_config.listenUrl(), credentials, m_stack_config.webSocketPingInterval());
175175
}
176176
else
177177
{

src/centralsystem/interface/ICentralSystemConfig.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ class ICentralSystemConfig
4747
virtual std::string listenUrl() const = 0;
4848
/** @brief Call request timeout */
4949
virtual std::chrono::milliseconds callRequestTimeout() const = 0;
50+
/** @brief Websocket PING interval */
51+
virtual std::chrono::seconds webSocketPingInterval() const = 0;
5052
/** @brief Boot notification retry interval */
5153
virtual std::chrono::seconds bootNotificationRetryInterval() const = 0;
5254
/** @brief Heartbeat interval */

0 commit comments

Comments
 (0)