类 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>。