From 48b3ffd7f994250c524c0ca06715ed26e79a452e Mon Sep 17 00:00:00 2001 From: Lorenzo Donini Date: Mon, 9 Apr 2018 16:25:34 +0200 Subject: [PATCH 1/2] Send entire ping payload within the pong response --- client_ws.hpp | 5 +++-- server_ws.hpp | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/client_ws.hpp b/client_ws.hpp index 6a2f2932..5ea0909e 100644 --- a/client_ws.hpp +++ b/client_ws.hpp @@ -586,8 +586,9 @@ namespace SimpleWeb { connection->set_timeout(); // Send pong - auto empty_send_stream = std::make_shared(); - connection->send(empty_send_stream, nullptr, connection->message->fin_rsv_opcode + 1); + auto pong_stream = std::make_shared(); + *pong_stream << message->string(); + connection->send(pong_stream, nullptr, fin_rsv_opcode + 1); if(this->on_ping) this->on_ping(connection); diff --git a/server_ws.hpp b/server_ws.hpp index 06e87001..0c5c1537 100644 --- a/server_ws.hpp +++ b/server_ws.hpp @@ -688,8 +688,9 @@ namespace SimpleWeb { connection->set_timeout(); // Send pong - auto empty_send_stream = std::make_shared(); - connection->send(empty_send_stream, nullptr, fin_rsv_opcode + 1); + auto pong_stream = std::make_shared(); + *pong_stream << message->string(); + connection->send(pong_stream, nullptr, fin_rsv_opcode + 1); if(endpoint.on_ping) endpoint.on_ping(connection); From f5d9f687d26c110b839166c084d6809f0677e5c7 Mon Sep 17 00:00:00 2001 From: lorenzodonini Date: Mon, 9 Apr 2018 22:50:46 +0200 Subject: [PATCH 2/2] Fix ping message access in client_ws --- client_ws.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client_ws.hpp b/client_ws.hpp index 5ea0909e..bc123a3d 100644 --- a/client_ws.hpp +++ b/client_ws.hpp @@ -587,8 +587,8 @@ namespace SimpleWeb { // Send pong auto pong_stream = std::make_shared(); - *pong_stream << message->string(); - connection->send(pong_stream, nullptr, fin_rsv_opcode + 1); + *pong_stream << connection->message->string(); + connection->send(pong_stream, nullptr, connection->message->fin_rsv_opcode + 1); if(this->on_ping) this->on_ping(connection);