File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed
src/GraphQL.Client/Websocket Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -402,12 +402,26 @@ public Task InitializeWebSocket()
402402#else
403403 _clientWebSocket = new ClientWebSocket ( ) ;
404404 _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
406408 {
407- // the following properties are not supported in Blazor WebAssembly and throw a PlatformNotSupportedException error when accessed
408409 _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+ {
409418 _clientWebSocket . Options . UseDefaultCredentials = ( ( HttpClientHandler ) Options . HttpMessageHandler ) . UseDefaultCredentials ;
410419 }
420+ catch ( PlatformNotSupportedException )
421+ {
422+ Debug . WriteLine ( "Property 'ClientWebSocketOptions.UseDefaultCredentials' not supported by current platform" ) ;
423+ }
424+
411425 Options . ConfigureWebsocketOptions ( _clientWebSocket . Options ) ;
412426#endif
413427 return _initializeWebSocketTask = ConnectAsync ( _internalCancellationToken ) ;
You can’t perform that action at this time.
0 commit comments