Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug Report] WebSockets not working on Web Assembly #3412

Open
imatrisciano opened this issue Dec 15, 2023 · 1 comment
Open

[Bug Report] WebSockets not working on Web Assembly #3412

imatrisciano opened this issue Dec 15, 2023 · 1 comment
Labels
enhancement New feature or request. IoTSDK Tracks all IoT SDK issues across the board

Comments

@imatrisciano
Copy link

Context

  • OS, version, SKU and CPU architecture used: N/A
  • Application's .NET Target Framework : net8.0
  • Device: Laptop
  • SDK version used: 1.42.1

Description of the issue

Connection to IoT Hub fails when the code is run in Blazor WebAssembly, even if a WebSockets transport is selected.
A NotSupportedException is raised with message Operation is not supported on this platform

Code sample exhibiting the issue

DeviceClient deviceClient = DeviceClient.CreateFromConnectionString(primaryConnectionString, TransportType.Mqtt_WebSocket_Only);
Here a link to a repository to easily replicate the issue: https://github.com/imatrisciano/azure-device-wasm-client-bug

Exception stack trace:

crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
Unhandled exception rendering component: Operation is not supported on this platform.
System.PlatformNotSupportedException: Operation is not supported on this platform.
at System.Net.Http.SocketsHttpHandler.get_SslOptions()
at Microsoft.Azure.Devices.Client.Transport.HttpClientHelper..ctor(Uri baseAddress, IAuthorizationProvider authenticationHeaderProvider, IDictionary`2 defaultErrorMapping, TimeSpan timeout, Http1TransportSettings transportSettings, ProductInfo productInfo, IWebProxy proxy, Boolean isClientPrimaryTransportHandler)
at Microsoft.Azure.Devices.Client.Transport.HttpTransportHandler..ctor(PipelineContext context, IotHubConnectionString iotHubConnectionString, Http1TransportSettings transportSettings, Boolean isClientPrimaryTransportHandler)
at Microsoft.Azure.Devices.Client.InternalClient..ctor(IotHubConnectionString iotHubConnectionString, ITransportSettings[] transportSettings, IDeviceClientPipelineBuilder pipelineBuilder, ClientOptions options)
at Microsoft.Azure.Devices.Client.ClientFactory.CreateFromConnectionString(String connectionString, IAuthenticationMethod authenticationMethod, ITransportSettings[] transportSettings, IDeviceClientPipelineBuilder pipelineBuilder, ClientOptions options)
at Microsoft.Azure.Devices.Client.ClientFactory.CreateFromConnectionString(String connectionString, IAuthenticationMethod authenticationMethod, TransportType transportType, IDeviceClientPipelineBuilder pipelineBuilder, ClientOptions options)
at Microsoft.Azure.Devices.Client.ClientFactory.CreateFromConnectionString(String connectionString, TransportType transportType, ClientOptions options)
at Microsoft.Azure.Devices.Client.DeviceClient.<>c__DisplayClass10_0.b__0()
at Microsoft.Azure.Devices.Client.DeviceClient.Create(Func`1 internalClientCreator)
at Microsoft.Azure.Devices.Client.DeviceClient.CreateFromConnectionString(String connectionString, TransportType transportType, ClientOptions options)
at azure_device_client_bug.Pages.Home.ConnectClient()
at azure_device_client_bug.Pages.Home.OnInitializedAsync()
at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync() blazor.webassembly.js:1:38555

@imatrisciano imatrisciano added the bug Something isn't working. label Dec 15, 2023
@github-actions github-actions bot added the IoTSDK Tracks all IoT SDK issues across the board label Dec 15, 2023
@timtay-microsoft
Copy link
Member

IIRC, we currently don't have any plans to add support for Web assembly, but we are tracking it in the discussion below:

#2104

@timtay-microsoft timtay-microsoft added enhancement New feature or request. and removed bug Something isn't working. labels Dec 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request. IoTSDK Tracks all IoT SDK issues across the board
Projects
None yet
Development

No branches or pull requests

2 participants