Skip to content

Open-source speech recognition toolkit for training, inference, streaming ASR, VAD, punctuation, speaker diarization pipelines, and OpenAI-compatible/MCP serving.

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

zhaomingworkdde24214fecb
diff --git a/funasr/runtime/websocket/funasr-ws-client.cpp b/funasr/runtime/websocket/funasr-ws-client.cpp
index 2691b26c8..23c68cc49 100644
--- a/funasr/runtime/websocket/funasr-ws-client.cpp
+++ b/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