Comments (2)
We've seen limitations at this point before (in earlier cases with WASM, see https://github.com/graphql-dotnet/graphql-client#blazor-webassembly-limitations).
Could you try to find out what type Options.HttpMessageHandler
actually is in your app (because it obviously isn't of type HttpClientHandler
or derived from it)?
from graphql-client.
Ah, I definitely see my issue here now. My MessageHandler is a custom class in order to get around SSL when using the Android emulator for testing. It was the best solution I found for MAUI testing when connecting to localhost:
dotnet/maui#8131
https://gist.github.com/Eilon/49e3c5216abfa3eba81e453d45cba2d4
The code I'm using looks like this:
public GraphQLHttpClient Client { get; set; }
var options = new GraphQLHttpClientOptions { HttpMessageHandler = GetInsecureHandler(), EndPoint = new Uri(endpoint) };
Client = new GraphQLHttpClient(options, new NewtonsoftJsonSerializer());
public HttpMessageHandler GetInsecureHandler()
{
var handler = new CustomAndroidMessageHandler();
handler.ServerCertificateCustomValidationCallback = (message, cert, chain, errors) =>
{
if (cert.Issuer.Equals("CN=localhost")) return true;
return errors == System.Net.Security.SslPolicyErrors.None;
};
return handler;
}
internal sealed class CustomAndroidMessageHandler : Xamarin.Android.Net.AndroidMessageHandler
{
protected override Javax.Net.Ssl.IHostnameVerifier GetSSLHostnameVerifier(Javax.Net.Ssl.HttpsURLConnection connection)
=> new CustomHostnameVerifier();
private sealed class CustomHostnameVerifier : Java.Lang.Object, Javax.Net.Ssl.IHostnameVerifier
{
public bool Verify(string? hostname, Javax.Net.Ssl.ISSLSession? session)
{
return
Javax.Net.Ssl.HttpsURLConnection.DefaultHostnameVerifier.Verify(hostname, session)
|| hostname == "10.0.2.2" && session.PeerPrincipal?.Name == "CN=localhost";
}
}
}
I am honestly not very familiar with SSL connections and backend development in general, could this solution be modified to be compatible? Or would the better option just be to somehow get a valid SSL certificate set up on the Android emulator?
Thank you so much for your patience and help!
from graphql-client.
Related Issues (20)
- Getting "System.Net.Http.HttpRequestException: No such host is known" on Windows HOT 1
- Upgrade from 4.0.2 to 6.0.1 results in InitializeWebsocketConnection() error
- Casting Error in GraphQL C# Library HOT 4
- MapConverter throws if extensions property is null
- .NET 8.0 Issue w/ SystemTextJsonSerializer HOT 1
- SendQueryAsync fails unless Uri has a trailing '/' HOT 1
- GraphQL.Client.Example fails with exception
- Subscription disposed but connection remains HOT 4
- first and take not working properly? HOT 2
- How to use Polly with this library? HOT 1
- AppSync's WS connection closing at initialization HOT 1
- Json Serialiser doesn't handle structs well and ignores type converters HOT 11
- Make it easier to use GraphQL’s constructor with HttpClient and only endpoint
- System.Text.Json.JsonException when parsing response from SendMutationAsync. HOT 1
- Please consider adding [StringSyntax("GraphQL")] attributes HOT 4
- Unused project reference to Newtonsoft.Json in GraphQL.Client.LocalExecution
- Cannot set content-type header in initial request establishing a GraphQL websocket connection HOT 6
- Variable parsing different between C# "GraphQLRequest" and json/webui HOT 6
- More samples please + Does this library support graphql-sse (server-sent events)? HOT 5
- WebSocket handler in GRAPHQL_TRANSPORT_WS protocol should not send GQL_COMPLETE when closing connection HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from graphql-client.