From 5ed359464f1683ca505d59bb4b8a7ed4ae98e10b Mon Sep 17 00:00:00 2001
From: zhaomingwork <zhaomingwork@qq.com>
Date: 星期五, 12 五月 2023 14:59:06 +0800
Subject: [PATCH] modified cpp websocket compatiple with python
---
funasr/runtime/websocket/websocketsrv.h | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/funasr/runtime/websocket/websocketsrv.h b/funasr/runtime/websocket/websocketsrv.h
index e484724..dea656f 100644
--- a/funasr/runtime/websocket/websocketsrv.h
+++ b/funasr/runtime/websocket/websocketsrv.h
@@ -46,6 +46,11 @@
float snippet_time;
} FUNASR_RECOG_RESULT;
+typedef struct {
+ nlohmann::json msg;
+ std::shared_ptr<std::vector<char>> samples;
+} FUNASR_MESSAGE;
+
class WebSocketServer {
public:
WebSocketServer(asio::io_context& io_decoder, server* server_)
@@ -87,6 +92,10 @@
std::map<websocketpp::connection_hdl, std::shared_ptr<std::vector<char>>,
std::owner_less<websocketpp::connection_hdl>>
sample_map;
+
+ std::map<websocketpp::connection_hdl, std::shared_ptr<FUNASR_MESSAGE>,
+ std::owner_less<websocketpp::connection_hdl>>
+ data_map;
websocketpp::lib::mutex m_lock; // mutex for sample_map
};
--
Gitblit v1.9.1