mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-15 00:15:15 +08:00
Websockets no longer working in Blazor WebAssembly (#1755)
* Fix for websockets not applying properties unless explicitly set * Added comment indicating why properties can't be set * Update ReleaseNotes.md --------- Co-authored-by: Christian <6939810+chkr1011@users.noreply.github.com>
This commit is contained in:
co-authored by
Christian
parent
94f9fac2bd
commit
0790e54794
@@ -1 +1 @@
|
|||||||
*
|
* [Client] Fixed _PlatformNotSupportedException_ when using Blazor (#1755, thanks to @Nickztar).
|
||||||
@@ -221,11 +221,22 @@ namespace MQTTnet.Implementations
|
|||||||
|
|
||||||
#if !NETSTANDARD1_3
|
#if !NETSTANDARD1_3
|
||||||
#if !WINDOWS_UWP
|
#if !WINDOWS_UWP
|
||||||
clientWebSocket.Options.UseDefaultCredentials = _options.UseDefaultCredentials;
|
// Only set the value if it is actually true. This property is not supported on all platforms
|
||||||
|
// and will throw a _PlatformNotSupported_ (i.e. WASM) exception when being used regardless of the actual value.
|
||||||
|
if (_options.UseDefaultCredentials)
|
||||||
|
{
|
||||||
|
clientWebSocket.Options.UseDefaultCredentials = _options.UseDefaultCredentials;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
clientWebSocket.Options.KeepAliveInterval = _options.KeepAliveInterval;
|
if (_options.KeepAliveInterval != WebSocket.DefaultKeepAliveInterval)
|
||||||
|
{
|
||||||
|
clientWebSocket.Options.KeepAliveInterval = _options.KeepAliveInterval;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
clientWebSocket.Options.Credentials = _options.Credentials;
|
if (_options.Credentials != null)
|
||||||
|
{
|
||||||
|
clientWebSocket.Options.Credentials = _options.Credentials;
|
||||||
|
}
|
||||||
|
|
||||||
var certificateValidationHandler = _options.TlsOptions?.CertificateValidationHandler;
|
var certificateValidationHandler = _options.TlsOptions?.CertificateValidationHandler;
|
||||||
if (certificateValidationHandler != null)
|
if (certificateValidationHandler != null)
|
||||||
|
|||||||
Reference in New Issue
Block a user