From 4f03f37b07d65a1b07d68e0a4a1fb0aafdb09b26 Mon Sep 17 00:00:00 2001 From: ithewei Date: Fri, 17 Nov 2023 19:48:02 +0800 Subject: [PATCH] echo WS_OPCODE_CLOSE --- http/client/WebSocketClient.cpp | 1 + http/server/HttpHandler.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/http/client/WebSocketClient.cpp b/http/client/WebSocketClient.cpp index ff3fc543e..492c10d77 100644 --- a/http/client/WebSocketClient.cpp +++ b/http/client/WebSocketClient.cpp @@ -143,6 +143,7 @@ int WebSocketClient::open(const char* _url, const http_headers& headers) { channel->opcode = (enum ws_opcode)opcode; switch (opcode) { case WS_OPCODE_CLOSE: + channel->send(msg, WS_OPCODE_CLOSE); channel->close(); break; case WS_OPCODE_PING: diff --git a/http/server/HttpHandler.cpp b/http/server/HttpHandler.cpp index dc081a007..a6a07c273 100644 --- a/http/server/HttpHandler.cpp +++ b/http/server/HttpHandler.cpp @@ -174,6 +174,7 @@ bool HttpHandler::SwitchWebSocket() { ws_channel->opcode = (enum ws_opcode)opcode; switch(opcode) { case WS_OPCODE_CLOSE: + ws_channel->send(msg, WS_OPCODE_CLOSE); ws_channel->close(); break; case WS_OPCODE_PING: