类 ConnectionMessage

ConnectionMessage 表示发送到语音服务以及从语音服务接收的特定于实现的消息。 这些消息用于调试目的,不应用于 Azure 认知服务语音服务的生产用例。 发送到语音服务以及从语音服务接收的消息如有更改,恕不另行通知。 这包括消息内容、标头、有效负载、排序等。在版本 1.10.0 中添加。

成员

属性

语法: public PropertyCollection & Properties;

为此 ConnectionMessage 定义的属性及其值的集合。 可以通过此集合 (访问邮件头,例如“Content-Type”) 。

ConnectionMessage

语法: public inline explicit ConnectionMessage ( SPXCONNECTIONMESSAGEHANDLE hcm );

构造函数。

参数

  • hcm 事件句柄。

~ConnectionMessage

语法: public inline virtual ~ConnectionMessage ( );

析构函数。

GetPath

语法: public inline std::string GetPath ( ) const;

获取消息路径。

返回

包含消息路径的 std::string。

IsTextMessage

语法: public inline bool IsTextMessage ( ) const;

检查 ConnectionMessage 是否为短信。 另请参阅 IsBinaryMessage () 。

返回

指示消息有效负载是否为文本的布尔值。

IsBinaryMessage

语法: public inline bool IsBinaryMessage ( ) const;

检查 ConnectionMessage 是否为二进制消息。 另请参阅 GetBinaryMessage () 。

返回

指示消息有效负载是否为二进制的布尔值。

GetTextMessage

语法: public inline std::string GetTextMessage ( ) const;

获取文本消息有效负载。 通常,文本消息内容类型为 application/json。 若要确定其他内容类型,请使用 Properties.GetProperty (“Content-Type”) 。

返回

包含文本消息的 std::string。

GetBinaryMessage

语法: public inline std::vector< uint8_t > GetBinaryMessage ( ) const;

获取二进制消息有效负载。

返回

包含二进制消息的 std::vector<uint8_t> 。