diff --git a/Source/MQTTnet/Client/Options/MqttClientCertificateValidationEventArgs.cs b/Source/MQTTnet/Client/Options/MqttClientCertificateValidationEventArgs.cs index f1842cb1e..ff4825612 100644 --- a/Source/MQTTnet/Client/Options/MqttClientCertificateValidationEventArgs.cs +++ b/Source/MQTTnet/Client/Options/MqttClientCertificateValidationEventArgs.cs @@ -14,8 +14,14 @@ public sealed class MqttClientCertificateValidationEventArgs : EventArgs public X509Chain Chain { get; set; } - public SslPolicyErrors SslPolicyErrors { get; set; } - public IMqttClientChannelOptions ClientOptions { get; set; } +#if NET452 || NET461 || NET48 + /// + /// Can be a host string name or an object derived from WebRequest. + /// + public object Sender { get; set; } +#endif + + public SslPolicyErrors SslPolicyErrors { get; set; } } -} +} \ No newline at end of file diff --git a/Source/MQTTnet/Implementations/MqttWebSocketChannel.cs b/Source/MQTTnet/Implementations/MqttWebSocketChannel.cs index b75688c82..be31c2a51 100644 --- a/Source/MQTTnet/Implementations/MqttWebSocketChannel.cs +++ b/Source/MQTTnet/Implementations/MqttWebSocketChannel.cs @@ -249,9 +249,11 @@ void SetupClientWebSocket(ClientWebSocket clientWebSocket) #elif WINDOWS_UWP throw new NotSupportedException("Remote certificate validation callback is not supported when using 'uap10.0'."); #elif NET452 || NET461 || NET48 - ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) => { + ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) => + { var context = new MqttClientCertificateValidationEventArgs { + Sender = sender, Certificate = certificate, Chain = chain, SslPolicyErrors = sslPolicyErrors,