File tree Expand file tree Collapse file tree 2 files changed +22
-2
lines changed
src/GraphQL.Client/Websocket Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -139,3 +139,9 @@ subscription.Dispose();
139139* [ GitHub GraphQL API Docs] ( https://developer.github.com/v4/guides/forming-calls/ )
140140* [ GitHub GraphQL Explorer] ( https://developer.github.com/v4/explorer/ )
141141* [ GitHub GraphQL Endpoint] ( https://api.github.com/graphql )
142+
143+ ## Blazor WebAssembly Limitations
144+
145+ Blazor WebAssembly differs from other platforms as it does not support all features of other .NET runtime implementations. For instance, the following WebSocket options properties are not supported and will not be set:
146+ * [ ClientCertificates] ( https://docs.microsoft.com/en-us/dotnet/api/system.net.websockets.clientwebsocketoptions.clientcertificates?view=netcore-3.1#System_Net_WebSockets_ClientWebSocketOptions_ClientCertificates )
147+ * [ UseDefaultCredentials] ( https://docs.microsoft.com/en-us/dotnet/api/system.net.websockets.clientwebsocketoptions.usedefaultcredentials?view=netcore-3.1 )
Original file line number Diff line number Diff line change @@ -407,8 +407,22 @@ public Task InitializeWebSocket()
407407#else
408408 _clientWebSocket = new ClientWebSocket ( ) ;
409409 _clientWebSocket . Options . AddSubProtocol ( "graphql-ws" ) ;
410- _clientWebSocket . Options . ClientCertificates = ( ( HttpClientHandler ) Options . HttpMessageHandler ) . ClientCertificates ;
411- _clientWebSocket . Options . UseDefaultCredentials = ( ( HttpClientHandler ) Options . HttpMessageHandler ) . UseDefaultCredentials ;
410+ try
411+ {
412+ _clientWebSocket . Options . ClientCertificates = ( ( HttpClientHandler ) Options . HttpMessageHandler ) . ClientCertificates ;
413+ }
414+ catch ( PlatformNotSupportedException )
415+ {
416+ Debug . WriteLine ( "unable to set Options.ClientCertificates property; platform does not support it" ) ;
417+ }
418+ try
419+ {
420+ _clientWebSocket . Options . UseDefaultCredentials = ( ( HttpClientHandler ) Options . HttpMessageHandler ) . UseDefaultCredentials ;
421+ }
422+ catch ( PlatformNotSupportedException )
423+ {
424+ Debug . WriteLine ( "unable to set Options.UseDefaultCredentials property; platform does not support it" ) ;
425+ }
412426 Options . ConfigureWebsocketOptions ( _clientWebSocket . Options ) ;
413427#endif
414428 return _initializeWebSocketTask = ConnectAsync ( _internalCancellationToken ) ;
You can’t perform that action at this time.
0 commit comments