ApplicationMessageReceived in server #1220
-
i am trying to use ApplicationMessageReceived inside server
but i am not getting the messeges in server. can anyone show me a sample code for same ?? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
mqttServer.ApplicationMessageReceivedHandler = new MqttApplicationMessageReceivedHandlerDelegate(OnAppMessage); |
Beta Was this translation helpful? Give feedback.
-
The Your example code with the delegate should work, as you found out, with |
Beta Was this translation helpful? Give feedback.
The
ApplicationMessageReceivedHandler
in the server works the same as in the client, but has the clientId as additional field: https://github.com/chkr1011/MQTTnet/wiki/Server#consuming-messages, https://github.com/chkr1011/MQTTnet/wiki/Client#consuming-messages.Your example code with the delegate should work, as you found out, with
async
methods.