Giter Club home page Giter Club logo

Comments (6)

Highland9r avatar Highland9r commented on September 26, 2024

I'm trying to use this library for GraphQL subscriptions but getting the following error "Connection closed by the server".

After more investigating, I find out that the initial request /graphql does not contain content-type header that is seem mandatory for the server I'm connecting to. I believe this is a reason of this error.
Could you please advice?

Thanks a lot in advance

from graphql-client.

rose-a avatar rose-a commented on September 26, 2024

The Content-Type header is irrelevant for a websocket connection (see also this stackoverflow thread).

Maybe your server needs some form of authentication?

from graphql-client.

Highland9r avatar Highland9r commented on September 26, 2024

Thank you so much on a response provided. Yes, you're right, the issue related to missing authentication:

image

However, I have set it via ConfigureWebsocketOptions and also via HttpClient as following:

image

But still getting this error.

Could you please advice?

Thank you in advance

from graphql-client.

rose-a avatar rose-a commented on September 26, 2024

Are u sure that is the authorization header your server expects? I've seen lots of different authorization variants, especially with GraphQL subscriptions (it's a bit like the wild west there...)

Please doublecheck the docs of your server how authentication/authorization with subscriptions work!

from graphql-client.

Highland9r avatar Highland9r commented on September 26, 2024

Yes, the server expects a bearer token.

It seems like an issue is caused by https redirection middleware (authentication header is not preserved on redirects). So, when I changed from ws:// to wss:// it starts to work.

from graphql-client.

Highland9r avatar Highland9r commented on September 26, 2024

Yeah, here we go: https://github.com/dotnet/runtime/blob/main/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/RedirectHandler.cs#L53-L54

from graphql-client.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.