mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-21 12:16:02 +08:00
Update docs
This commit is contained in:
@@ -3,13 +3,13 @@ _mqttClient.subscribe("MQTTnet.RPC/+/ping");
|
|||||||
_mqttClient.subscribe("MQTTnet.RPC/+/do_something");
|
_mqttClient.subscribe("MQTTnet.RPC/+/do_something");
|
||||||
|
|
||||||
// It is not allowed to change the structure of the topic. Otherwise RPC will not work. So method names can be separated using
|
// It is not allowed to change the structure of the topic. Otherwise RPC will not work. So method names can be separated using
|
||||||
// an _ or . but no +, # or /.. If it is required to distinguish between devices own rules can be defined like the following.
|
// an _ or . but no +, # or . If it is required to distinguish between devices own rules can be defined like the following.
|
||||||
_mqttClient.subscribe("MQTTnet.RPC/+/deviceA.ping");
|
_mqttClient.subscribe("MQTTnet.RPC/+/deviceA.ping");
|
||||||
_mqttClient.subscribe("MQTTnet.RPC/+/deviceB.ping");
|
_mqttClient.subscribe("MQTTnet.RPC/+/deviceB.ping");
|
||||||
_mqttClient.subscribe("MQTTnet.RPC/+/deviceC.getTemperature");
|
_mqttClient.subscribe("MQTTnet.RPC/+/deviceC.getTemperature");
|
||||||
|
|
||||||
// Within the callback of the mqtt client the topic must be checked if it belongs to MQTTnet RPC. The following code shows one
|
// Within the callback of the MQTT client the topic must be checked if it belongs to MQTTnet RPC. The following code shows one
|
||||||
// possible way.
|
// possible way of doing this.
|
||||||
void mqtt_Callback(char *topic, byte *payload, unsigned int payloadLength)
|
void mqtt_Callback(char *topic, byte *payload, unsigned int payloadLength)
|
||||||
{
|
{
|
||||||
String topicString = String(topic);
|
String topicString = String(topic);
|
||||||
@@ -24,5 +24,6 @@ void mqtt_Callback(char *topic, byte *payload, unsigned int payloadLength)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do not send response message with the _retain_ flag set to true.
|
// Important notes:
|
||||||
// All required data for a RPC call and the result must be placed into the payload.
|
// ! Do not send response message with the _retain_ flag set to true.
|
||||||
|
// ! All required data for a RPC call and the result must be placed into the payload.
|
||||||
@@ -21,7 +21,7 @@ MQTTnet is a high performance .NET library for MQTT based communication. It prov
|
|||||||
* Performance optimized (processing ~40.000 messages / second)*
|
* Performance optimized (processing ~40.000 messages / second)*
|
||||||
* Interfaces included for mocking and testing
|
* Interfaces included for mocking and testing
|
||||||
* Access to internal trace messages
|
* Access to internal trace messages
|
||||||
* Unit tested (70+ tests)
|
* Unit tested (~80 tests)
|
||||||
|
|
||||||
\* Tested on local machine (Intel i7 8700K) with MQTTnet client and server running in the same process using the TCP channel. The app for verification is part of this repository and stored in _/Tests/MQTTnet.TestApp.NetCore_.
|
\* Tested on local machine (Intel i7 8700K) with MQTTnet client and server running in the same process using the TCP channel. The app for verification is part of this repository and stored in _/Tests/MQTTnet.TestApp.NetCore_.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user