Przeglądaj źródła

fix cpp ws client not exit when finished problem (#628)

zhaomingwork 2 lat temu
rodzic
commit
dde24214fe
1 zmienionych plików z 6 dodań i 0 usunięć
  1. 6 0
      funasr/runtime/websocket/funasr-ws-client.cpp

+ 6 - 0
funasr/runtime/websocket/funasr-ws-client.cpp

@@ -132,8 +132,14 @@ class WebsocketClient {
             }
             send_wav_data(wav_list[i], wav_ids[i]);
         }
+        WaitABit();
+		m_client.close(m_hdl,websocketpp::close::status::going_away, "", ec);
+        if (ec) {
+                std::cout << "> Error closing connection " << ec.message() << std::endl;
+            }
         //send_wav_data();
         asio_thread.join();
+
     }
 
     // The open handler will signal that we are ready to start sending data