File tree Expand file tree Collapse file tree 1 file changed +3
-13
lines changed
src/GraphQL.Client/Websocket Expand file tree Collapse file tree 1 file changed +3
-13
lines changed Original file line number Diff line number Diff line change @@ -408,22 +408,12 @@ public Task InitializeWebSocket()
408408#else
409409 _clientWebSocket = new ClientWebSocket ( ) ;
410410 _clientWebSocket . Options . AddSubProtocol ( "graphql-ws" ) ;
411- try
411+ if ( ! System . Runtime . InteropServices . RuntimeInformation . IsOSPlatform ( System . Runtime . InteropServices . OSPlatform . Create ( "WEBASSEMBLY" ) ) )
412412 {
413+ // the following properties are not supported in Blazor WebAssembly and throw a PlatformNotSupportedException error when accessed
413414 _clientWebSocket . Options . ClientCertificates = ( ( HttpClientHandler ) Options . HttpMessageHandler ) . ClientCertificates ;
414- }
415- catch ( PlatformNotSupportedException )
416- {
417- Debug . WriteLine ( "unable to set Options.ClientCertificates property; platform does not support it" ) ;
418- }
419- try
420- {
421415 _clientWebSocket . Options . UseDefaultCredentials = ( ( HttpClientHandler ) Options . HttpMessageHandler ) . UseDefaultCredentials ;
422416 }
423- catch ( PlatformNotSupportedException )
424- {
425- Debug . WriteLine ( "unable to set Options.UseDefaultCredentials property; platform does not support it" ) ;
426- }
427417 Options . ConfigureWebsocketOptions ( _clientWebSocket . Options ) ;
428418#endif
429419 return _initializeWebSocketTask = ConnectAsync ( _internalCancellationToken ) ;
@@ -627,7 +617,7 @@ public void Complete()
627617
628618 /// <summary>
629619 /// Task to await the completion (a.k.a. disposal) of this websocket.
630- /// </summary>
620+ /// </summary>
631621 /// Async disposal as recommended by Stephen Cleary (https://blog.stephencleary.com/2013/03/async-oop-6-disposal.html)
632622 public Task ? Completion { get ; private set ; }
633623
You can’t perform that action at this time.
0 commit comments