Add 'reason' message to websocket close method
Now websocket client receives a proper reason from a server.
Removed filling asyncResp from onopen() method from nbdproxy.h
because it was redundant. Websocket does not response to client
using asyncResp.
Removed close from NbdProxyServer destructor because it is always
called in onclose() method.
Tested:
- Mounted and unmounted virtual media using proxy mode few times
as administrator with success.
- Mounted virtual media using proxy mode as operator and receives
proper reason on client side.
- Verify if errors are received properly on client side when
mounting operation fails.
Signed-off-by: Wludzik, Jozef <jozef.wludzik@intel.com>
Change-Id: If3b1cc9782de71a0975416872bc2fe8e3824148a
diff --git a/http/websocket.h b/http/websocket.h
index b89a74b..91b537b 100644
--- a/http/websocket.h
+++ b/http/websocket.h
@@ -166,7 +166,7 @@
void close(const std::string_view msg) override
{
ws.async_close(
- boost::beast::websocket::close_code::normal,
+ {boost::beast::websocket::close_code::normal, msg},
[self(shared_from_this())](boost::system::error_code ec) {
if (ec == boost::asio::error::operation_aborted)
{