如何在提升野兽网络套接字中传递模型类型
How do I pass the model type in boost beast websocket
我正在使用c ++ 11,beast库和IBM语音转文本Web服务。
在执行握手时,websocket 接口(用于连接(需要authentication token
作为请求标头。
参考 Watson 文档中提供的这段代码,看起来我也必须将模型类型(如果需要(作为请求标头传递
var IAM_access_token = '{access_token}';
var wsURI = 'wss://stream.watsonplatform.net/speech-to-text/api/v1/recognize'
+ '?access_token=' + IAM_access_token
+ '&model=es-ES_BroadbandModel';
var websocket = new WebSocket(wsURI);
还提到了一个 curl 请求格式来设置"模型">
curl -X POST -u "apikey:{apikey}"
--header "Content-Type: audio/flac"
--data-binary @{path}audio-file.flac
"https://stream.watsonplatform.net/speech-to-text/api/v1/recognize?model=en-US_NarrowbandModel"
有人可以告诉我如何在我的 websocket 中传递"模型"(在 c++11 中使用 beast(吗?
以下是我传递身份验证令牌的方式:
mWebSocket.async_handshake_ex(mHost, "/speech-to-text/api/v1/recognize",
[mToken](request_type& reqHead) {
reqHead.insert(http::field::authorization,mToken);},
bind(&IbmWebsocketSession::send_start, shared_from_this(), placeholders::_1));
正如
@ALanBirtles所建议
的将 url 中的重新model
作为
mWebSocket.async_handshake_ex(mHost, "/speech-to-text/api/v1/recognize?model=en-US_NarrowbandModel",...
工程
相关文章:
- ArduinoJson 6.15.2:JsonObject没有命名类型
- 防止主数据类型C++的隐式转换
- 大量序列中核苷酸类型的快速计数
- 如何从C++中的依赖类型中获得它所依赖的类型
- 有关插入适配器的错误。[错误]请求从 'back_insert_iterator<vector<>>' 类型转换为非标量类型
- 是否可以初始化不可复制类型的成员变量(或基类)
- 如何获取std::result_of函数的返回类型
- 从父命名空间重载类型
- 如果C++类在类方法中具有动态分配,但没有构造函数/析构函数或任何非静态成员,那么它仍然是POD类型吗
- 我想将一个对T类型的非常量左值引用绑定到一个T类型的临时值
- 模型类/子类,其中子类类型在C++中先验未知
- Qt 模型拖放 - 无法保存类型 QJsonValue
- 如何使用 c++ 模型填充播放列表 qml 类型
- 如何在提升野兽网络套接字中传递模型类型
- 当DLL( 标头)是预期的交付时,如何在C 中实现预测模型(具有100个参数的10种类型)
- Linux数据模型和基元类型大小
- 是可用于 c++ 的“Django 模型”类型抽象
- 具有变量数量和常量变量类型的类的编程模型
- 如何在simp中将OBJMTL模型转换为导出类型
- c++中简单的类型驱动随机模型构造