Add ClientId for application messages published by the server.

This commit is contained in:
Christian Kratky
2019-04-24 21:37:29 +02:00
parent 9da3377aa7
commit 6ed3b0cedd
4 changed files with 21 additions and 2 deletions
@@ -364,7 +364,13 @@ namespace MQTTnet.Server
return null;
}
var interceptorContext = new MqttApplicationMessageInterceptorContext(sender?.ClientId, applicationMessage);
var senderClientId = sender?.ClientId;
if (sender == null)
{
senderClientId = _options.ClientId;
}
var interceptorContext = new MqttApplicationMessageInterceptorContext(senderClientId, applicationMessage);
await interceptor.InterceptApplicationMessagePublishAsync(interceptorContext).ConfigureAwait(false);
return interceptorContext;
}