(ws) ws echo_server gains a new option (-p) to disable responding to pings with pongs

This commit is contained in:
Benjamin Sergeant
2020-03-18 00:01:57 -07:00
parent 8ec515f292
commit d6f534de06
5 changed files with 14 additions and 4 deletions

View File

@ -16,7 +16,8 @@ namespace ix
const std::string& hostname,
const ix::SocketTLSOptions& tlsOptions,
bool ipv6,
bool disablePerMessageDeflate)
bool disablePerMessageDeflate,
bool disablePong)
{
spdlog::info("Listening on {}:{}", hostname, port);
@ -35,6 +36,12 @@ namespace ix
server.disablePerMessageDeflate();
}
if (disablePong)
{
spdlog::info("Disable responding to PING messages with PONG");
server.disablePong();
}
server.setOnConnectionCallback(
[greetings](std::shared_ptr<ix::WebSocket> webSocket,
std::shared_ptr<ConnectionState> connectionState) {