File tree 1 file changed +16
-2
lines changed
src/GraphQL.Client/Websocket
1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -402,12 +402,26 @@ public Task InitializeWebSocket()
402
402
#else
403
403
_clientWebSocket = new ClientWebSocket ( ) ;
404
404
_clientWebSocket . Options . AddSubProtocol ( "graphql-ws" ) ;
405
- if ( ! System . Runtime . InteropServices . RuntimeInformation . IsOSPlatform ( System . Runtime . InteropServices . OSPlatform . Create ( "BROWSER" ) ) )
405
+
406
+ // the following properties are not supported in Blazor WebAssembly and throw a PlatformNotSupportedException error when accessed
407
+ try
406
408
{
407
- // the following properties are not supported in Blazor WebAssembly and throw a PlatformNotSupportedException error when accessed
408
409
_clientWebSocket . Options . ClientCertificates = ( ( HttpClientHandler ) Options . HttpMessageHandler ) . ClientCertificates ;
410
+ }
411
+ catch ( PlatformNotSupportedException )
412
+ {
413
+ Debug . WriteLine ( "property 'ClientWebSocketOptions.ClientCertificates' not supported by current platform" ) ;
414
+ }
415
+
416
+ try
417
+ {
409
418
_clientWebSocket . Options . UseDefaultCredentials = ( ( HttpClientHandler ) Options . HttpMessageHandler ) . UseDefaultCredentials ;
410
419
}
420
+ catch ( PlatformNotSupportedException )
421
+ {
422
+ Debug . WriteLine ( "Property 'ClientWebSocketOptions.UseDefaultCredentials' not supported by current platform" ) ;
423
+ }
424
+
411
425
Options . ConfigureWebsocketOptions ( _clientWebSocket . Options ) ;
412
426
#endif
413
427
return _initializeWebSocketTask = ConnectAsync ( _internalCancellationToken ) ;
You can’t perform that action at this time.
0 commit comments