请求方还可以在请求中携带关联数据 (Correlation Data),响应方必须在响应中将关联数据原封不动地返回,请求方因此可以识别响应所属的原始请求。 这可以避免在响应方没有按请求顺序返回响应或者由于网络连接断开导致丢失了某个响应 (QoS 0) 时,请求方不正确地关联响应与原始请求。 另一方面,请求方可能需要与多个响应方交互,譬如
6 Response Topic【UTF-8 String】//3.1.3.2.7 Correlation Data 【Binary Data】//3.1.3.2.8 User Property【UTF-8 String Pair】//3.1.3.3 Will Topic 【UTF-8 String】//3.1.3.4 Will Payload【Binary Data】//3.1.3.5 User Name【UTF-8 String】//3.1.3.6 Password【Binary Data...
"response_topic": "some_other_topic", "correlation_data": "string", "user_properties": { "foo": "bar" }, "content_type": "text/plain" }, "retain": False } response = requests.post(url, headers=headers, data=json.dumps(data)) if response.status_code == 200: print("消息发布成功...
Now every time a new WebSocket connection is opened (hopefully not too often), we will get a fresh signed url or fresh auth token data. Note: Currently this hook doesnotsupport promises, meaning that in order to use the latest auth token, you must have some outside mechanism running that...
In v1.7.0, theRequest Responsein MQTT 5.0 is supported, and the configuration of Response Topic and Correlation Data is provided, The response message is routed back to the publisher of the request. Because the MQTT protocol is based on the Pub/Sub model, which is different from the request...
Correlation DataBinary data used by the sender of the request message to identify which request the response message is for.BinaryPUBLISH, CONNECT User PropertyA UTF-8 string pair. This property can appear multiple times in one packet. Receivers will receive the key-value pairs in the same orde...
response topic of the MQTT publish request"mqttcorrelationdata":"cmVxdWVzdDE=", // dynamic enrichment of the correlation data of the MQTT publish request encoded in base64"mqttpfi":0, // dynamic enrichment of the payload format indicator of the MQTT publish request"datacontenttype":"application...
//3.1.3.2.7 Correlation Data 【Binary Data】 //3.1.3.2.8 User Property【UTF-8 String Pair】 //3.1.3.3 Will Topic 【UTF-8 String】 //3.1.3.4 Will Payload【Binary Data】 //3.1.3.5 User Name【UTF-8 String】 //3.1.3.6 Password【Binary Data】 ...
correlation_data = "124", payload = "ON" )def request_and_response(clients, callbacks, request_topic, response_topic, correlation_data, payload): # Set Response Topic and Correlation Data properties = Properties(PacketTypes.PUBLISH) properties.ResponseTopic = response_topic ...
* 关联数据 Correlation Data:字节值为9 (0x09) 为关联数据的标识符。后跟二进制数据。请求消息的发送方使用关联数据来识别响应消息在收到时是针对哪个请求的。多次包含关联数据属于协议错误。如果关联数据不存在,则请求者不需要任何关联数据。关联数据的值只对请求消息的发送者和响应消息的接收者有意义。