@@ -40,8 +40,14 @@ class WSSClient : public HTTP::HTTPSClient, protected WebSocket
4040 bool Connect (const std::shared_ptr<Asio::TCPResolver>& resolver) override ;
4141 bool ConnectAsync () override ;
4242 bool ConnectAsync (const std::shared_ptr<Asio::TCPResolver>& resolver) override ;
43- virtual bool Close (int status) { SendClose (status, nullptr , 0 ); HTTPSClient::Disconnect (); return true ; }
44- virtual bool CloseAsync (int status) { SendCloseAsync (status, nullptr , 0 ); HTTPSClient::DisconnectAsync (); return true ; }
43+ virtual bool Close () { return Close (0 , nullptr , 0 ); }
44+ virtual bool Close (int status) { return Close (status, nullptr , 0 ); }
45+ virtual bool Close (int status, const void * buffer, size_t size) { SendClose (status, buffer, size); HTTPSClient::Disconnect (); return true ; }
46+ virtual bool Close (int status, std::string_view text) { SendClose (status, text); HTTPSClient::Disconnect (); return true ; }
47+ virtual bool CloseAsync () { return CloseAsync (0 , nullptr , 0 ); }
48+ virtual bool CloseAsync (int status) { return CloseAsync (status, nullptr , 0 ); }
49+ virtual bool CloseAsync (int status, const void * buffer, size_t size) { SendCloseAsync (status, buffer, size); HTTPSClient::DisconnectAsync (); return true ; }
50+ virtual bool CloseAsync (int status, std::string_view text) { SendCloseAsync (status, text); HTTPSClient::DisconnectAsync (); return true ; }
4551
4652 // WebSocket send text methods
4753 size_t SendText (const void * buffer, size_t size) { std::scoped_lock locker (_ws_send_lock); PrepareSendFrame (WS_FIN | WS_TEXT, true , buffer, size); return HTTPSClient::Send (_ws_send_buffer.data (), _ws_send_buffer.size ()); }
@@ -98,7 +104,7 @@ class WSSClient : public HTTP::HTTPSClient, protected WebSocket
98104 void onReceivedResponseError (const HTTP::HTTPResponse& response, const std::string& error) override ;
99105
100106 // ! Handle WebSocket close notification
101- void onWSClose (const void * buffer, size_t size) override { CloseAsync (1000 ); }
107+ void onWSClose (const void * buffer, size_t size, int status = 1000 ) override { CloseAsync (); }
102108 // ! Handle WebSocket ping notification
103109 void onWSPing (const void * buffer, size_t size) override { SendPongAsync (buffer, size); }
104110 // ! Handle WebSocket error notification
0 commit comments