Skip to content

Subscribe with Authentication is not working for me #172

@ClarenceMG

Description

@ClarenceMG
var options = new GraphQLHttpClientOptions
{
     EndPoint = new Uri(APIUrl)
};

var httpClient = new HttpClient();
httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);

var graphQLHttpClient = new GraphQLHttpClient(options, httpClient, new GraphQL.Client.Serializer.Newtonsoft.NewtonsoftJsonSerializer()); 

This is my client.

Now I try to subscribe:

IObservable<GraphQLResponse<object>> subscriptionStream = graphQLHttpClient.CreateSubscriptionStream<object>(request);

IDisposable subscription = subscriptionStream.Subscribe(response =>
{
    var value = response.Data;
    if (response.Data != null)
    {
        var serializeResponse = JsonConvert.SerializeObject(response);
        Console.WriteLine(serializeResponse);
    }
});

But I never receive a response.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions