Set is_final and start_time for online websocket server. (#342)

* Set is_final and start_time for online websocket server.

* Convert timestamps to a json array
This commit is contained in:
Fangjun Kuang
2023-09-25 15:12:07 +08:00
committed by GitHub
parent c2518a5826
commit 552a267c23
10 changed files with 64 additions and 275 deletions

View File

@@ -195,9 +195,14 @@ void OnlineWebsocketDecoder::Decode() {
for (auto c : c_vec) {
auto result = recognizer_->GetResult(c->s.get());
if (recognizer_->IsEndpoint(c->s.get())) {
result.is_final = true;
recognizer_->Reset(c->s.get());
}
if (!recognizer_->IsReady(c->s.get()) && c->eof) {
result.is_final = true;
}
asio::post(server_->GetConnectionContext(),
[this, hdl = c->hdl, str = result.AsJsonString()]() {
server_->Send(hdl, str);