From f6b8eba01e4e8f66ebab64b6bf8566ce0c5585e0 Mon Sep 17 00:00:00 2001 From: shuax Date: Tue, 3 Mar 2020 14:06:22 +0800 Subject: [PATCH] https://tools.ietf.org/html/rfc6455#section-5.5.3 A Pong frame sent in response to a Ping frame must have identical "Application data" as found in the message body of the Ping frame being replied to. --- lualib/http/websocket.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lualib/http/websocket.lua b/lualib/http/websocket.lua index 4f901cee..6b038744 100755 --- a/lualib/http/websocket.lua +++ b/lualib/http/websocket.lua @@ -267,7 +267,7 @@ local function resolve_accept(self) try_handle(self, "close", code, reason) break elseif op == "ping" then - write_frame(self, "pong") + write_frame(self, "pong", payload_data) try_handle(self, "ping") elseif op == "pong" then try_handle(self, "pong") @@ -448,7 +448,7 @@ function M.read(id) _close_websocket(ws_obj) return false, payload_data elseif op == "ping" then - write_frame(ws_obj, "pong") + write_frame(ws_obj, "pong", payload_data) elseif op ~= "pong" then -- op is frame, text binary if fin and not recv_buf then return payload_data