MQTTnet.AspNetCore.Routing
MQTTnet.AspNetCore.Routing copied to clipboard
When the server is Sending a Message, the message get descarded from the MqttRouter
Describe the bug
Inside one of the controller Route I'm using this code to send an message to all subscriber // Now inject the new message at the broker. await Server.InjectApplicationMessage(new InjectedMqttApplicationMessage(msg) { SenderClientId = MqttServerConstants.ClientId });
But What I found is an error on the Logs saying that the Message will be drop
https://github.com/IoTSharp/MQTTnet.AspNetCore.Routing/blob/4649da9e28e87b87501962525c96107a6741f491/Source/Routing/MqttRouter.cs#L51
To Reproduce
Steps to reproduce the behavior:
-
Using this version of MQTTnet 4.X.X
-
Create a controller then send a message using
Server.InjectApplicationMessage
-
Make sure you are using: app.UseMqttServer(server => { server.WithAttributeRouting(app.ApplicationServices, allowUnmatchedRoutes: false); });
-
See error.
Expected behavior
A clear and concise description of what you expected to happen.
Need the ability to ignore the Server message from the router by maybe looking at the sender id
Screenshots
None
Additional context / logging
Using this example https://github.com/dotnet/MQTTnet/blob/7f5c437c46dd52ecb1d53dfc8ea9fb8ff46caf5d/Samples/Server/Server_Simple_Samples.cs#L53C12-L53C55
dbug: MQTTnet.AspNetCore.Routing.MqttRouter[0]
Rejecting message publish because 'route/path' did not match any known routes.