graphql-dotnet / graphql-dotnet/graphql-client
Could not connect with AWS graphQL client (Appsync APIs)
- Dominant language
- C#
- Stars
- 648
- Forks
- 136
- PR merge metrics
- No merged PRs in 30d
Description
I am trying to implement the same example given below in python with .net and this grahQL-client nuget but I am always getting error that the "server closed the connection without a closing handshake".
https://aws.amazon.com/blogs/mobile/appsync-websockets-python/
The code in above sample is working good in python.
could any please help with this. I am trying to fix from last two week. Not sure its something inside the library or I am not able to use the library correctly.
My code looks like
```csharp
var header = System.Convert.ToBase64String(Encoding.UTF8.GetBytes("{'host': '--HOST Name here--', 'x-api-key': '--APISYNC KEY HERE--'}"));
var gQL = new GraphQLHttpClient("--WEBSOCKET URL HERE--", new NewtonsoftJsonSerializer());
gQL.HttpClient.DefaultRequestHeaders.Add("header", header);
var request = new GraphQLHttpRequest{Query = "subscription SubscribeToEventComments{ subscribeToEventComments(eventId: 'test'){ content }}",OperationName = "SubscribeToEventComments", Variables = new{}};
IObservable > subscriptionStream = gQL.CreateSubscriptionStream(request, (Exception ex)=>{
Console.WriteLine(ex.ToString());
});
var subscription = subscriptionStream.Subscribe(response =>
{
Console.WriteLine($"user '{Newtonsoft.Json.JsonConvert.SerializeObject(response)}' joined");
},
ex=>{
Console.WriteLine(ex.ToString());
});
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.