diff --git a/include/net/http_wsserver.h b/include/net/http_wsserver.h index 9535f49..e87be8d 100644 --- a/include/net/http_wsserver.h +++ b/include/net/http_wsserver.h @@ -37,6 +37,9 @@ namespace ylib /// 发送 /// bool send(int64 conn, std::string_view value); + /// @brief 断开连接 + /// @param conn + void disconn(int64 conn); void on_accept(std::function callback) { m_callback_accept = callback; } void on_recv(std::function callback) { m_callback_recv = callback; } diff --git a/src/net/http_wsserver.cpp b/src/net/http_wsserver.cpp index 29a87a1..8b8ae16 100644 --- a/src/net/http_wsserver.cpp +++ b/src/net/http_wsserver.cpp @@ -1,5 +1,4 @@ #include "net/http_wsserver.h" -//#include "HPSocket/HPSocket.h" #include "HPSocket/HPSocket-SSL.h" #include "util/codec.h" @@ -231,6 +230,7 @@ void ylib::network::http::wsserver::stop() bool ylib::network::http::wsserver::send(int64 conn, std::string_view value) { + BOOL bFinal; BYTE iReserved; BYTE iOperationCode; @@ -238,3 +238,8 @@ bool ylib::network::http::wsserver::send(int64 conn, std::string_view value) return false; return HPSERVER->SendWSMessage(conn,bFinal,iReserved,iOperationCode,(const BYTE*)value.data(),value.length()); } + +void ylib::network::http::wsserver::disconn(int64 conn) +{ + HPSERVER->Disconnect(conn); +}