Remove AsyncResp from openHandler

This change, moving the openHandler back to only supporting websocket
disconnects and not 404s.Because AsyncResp is removed from openHandler.

Tested:
(from previous commit) Opened KVM in webui-vue and it works.

Signed-off-by: zhanghaicheng <zhanghch05@inspur.com>
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I793f05836aeccdc275b7aaaeede41b3a2c276595
diff --git a/http/routing.hpp b/http/routing.hpp
index 0fa2497..29ae22b 100644
--- a/http/routing.hpp
+++ b/http/routing.hpp
@@ -397,9 +397,7 @@
     }
 
   protected:
-    std::function<void(crow::websocket::Connection&,
-                       std::shared_ptr<bmcweb::AsyncResp>)>
-        openHandler;
+    std::function<void(crow::websocket::Connection&)> openHandler;
     std::function<void(crow::websocket::Connection&, const std::string&, bool)>
         messageHandler;
     std::function<void(crow::websocket::Connection&, const std::string&)>
diff --git a/http/websocket.hpp b/http/websocket.hpp
index bd7b841..b2c24c4 100644
--- a/http/websocket.hpp
+++ b/http/websocket.hpp
@@ -70,8 +70,7 @@
   public:
     ConnectionImpl(
         const crow::Request& reqIn, Adaptor adaptorIn,
-        std::function<void(Connection&, std::shared_ptr<bmcweb::AsyncResp>)>
-            openHandler,
+        std::function<void(Connection&)> openHandler,
         std::function<void(Connection&, const std::string&, bool)>
             messageHandler,
         std::function<void(Connection&, const std::string&)> closeHandler,
@@ -199,14 +198,11 @@
     {
         BMCWEB_LOG_DEBUG << "Websocket accepted connection";
 
-        auto asyncResp = std::make_shared<bmcweb::AsyncResp>();
-
-        asyncResp->res.result(boost::beast::http::status::ok);
         doRead();
 
         if (openHandler)
         {
-            openHandler(*this, asyncResp);
+            openHandler(*this);
         }
     }
 
@@ -286,8 +282,7 @@
     std::vector<std::string> outBuffer;
     bool doingWrite = false;
 
-    std::function<void(Connection&, std::shared_ptr<bmcweb::AsyncResp>)>
-        openHandler;
+    std::function<void(Connection&)> openHandler;
     std::function<void(Connection&, const std::string&, bool)> messageHandler;
     std::function<void(Connection&, const std::string&)> closeHandler;
     std::function<void(Connection&)> errorHandler;
diff --git a/include/dbus_monitor.hpp b/include/dbus_monitor.hpp
index 8519b5a..764d157 100644
--- a/include/dbus_monitor.hpp
+++ b/include/dbus_monitor.hpp
@@ -109,8 +109,7 @@
     BMCWEB_ROUTE(app, "/subscribe")
         .privileges({{"Login"}})
         .websocket()
-        .onopen([&](crow::websocket::Connection& conn,
-                    const std::shared_ptr<bmcweb::AsyncResp>&) {
+        .onopen([&](crow::websocket::Connection& conn) {
             BMCWEB_LOG_DEBUG << "Connection " << &conn << " opened";
             sessions.try_emplace(&conn);
         })
diff --git a/include/kvm_websocket.hpp b/include/kvm_websocket.hpp
index d45d414..fa61b75 100644
--- a/include/kvm_websocket.hpp
+++ b/include/kvm_websocket.hpp
@@ -161,8 +161,7 @@
     BMCWEB_ROUTE(app, "/kvm/0")
         .privileges({{"ConfigureComponents", "ConfigureManager"}})
         .websocket()
-        .onopen([](crow::websocket::Connection& conn,
-                   const std::shared_ptr<bmcweb::AsyncResp>&) {
+        .onopen([](crow::websocket::Connection& conn) {
             BMCWEB_LOG_DEBUG << "Connection " << &conn << " opened";
 
             if (sessions.size() == maxSessions)
diff --git a/include/nbd_proxy.hpp b/include/nbd_proxy.hpp
index e0a0111..9f46c03 100644
--- a/include/nbd_proxy.hpp
+++ b/include/nbd_proxy.hpp
@@ -255,8 +255,7 @@
 {
     BMCWEB_ROUTE(app, "/nbd/<str>")
         .websocket()
-        .onopen([](crow::websocket::Connection& conn,
-                   const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
+        .onopen([](crow::websocket::Connection& conn) {
             BMCWEB_LOG_DEBUG << "nbd-proxy.onopen(" << &conn << ")";
 
             auto getUserInfoHandler = [&conn, asyncResp](
diff --git a/include/obmc_console.hpp b/include/obmc_console.hpp
index 01ee479..fc99d41 100644
--- a/include/obmc_console.hpp
+++ b/include/obmc_console.hpp
@@ -118,8 +118,7 @@
     BMCWEB_ROUTE(app, "/console0")
         .privileges({{"ConfigureComponents", "ConfigureManager"}})
         .websocket()
-        .onopen([](crow::websocket::Connection& conn,
-                   const std::shared_ptr<bmcweb::AsyncResp>&) {
+        .onopen([](crow::websocket::Connection& conn) {
             BMCWEB_LOG_DEBUG << "Connection " << &conn << " opened";
 
             sessions.insert(&conn);
diff --git a/include/vm_websocket.hpp b/include/vm_websocket.hpp
index 5adf303..6c97f85 100644
--- a/include/vm_websocket.hpp
+++ b/include/vm_websocket.hpp
@@ -165,8 +165,7 @@
     BMCWEB_ROUTE(app, "/vm/0/0")
         .privileges({{"ConfigureComponents", "ConfigureManager"}})
         .websocket()
-        .onopen([](crow::websocket::Connection& conn,
-                   const std::shared_ptr<bmcweb::AsyncResp>&) {
+        .onopen([](crow::websocket::Connection& conn) {
             BMCWEB_LOG_DEBUG << "Connection " << &conn << " opened";
 
             if (session != nullptr)