Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting WebSocket connection to 'ws://localhost:7080/query' failed on connecting graphql-ws client with gqlgen golang server #185

Closed
sagg155 opened this issue May 24, 2021 · 8 comments
Labels
unrelated Not relevant, related or caused by the lib

Comments

@sagg155
Copy link

sagg155 commented May 24, 2021

Screenshot
image

Expected Behaviour
Should have connected with server but failed

Actual Behaviour
but instead it give WebSocket connection to 'ws://localhost:7080/query' failed

Debug Information
Issue mentioned on stackoverflow
https://stackoverflow.com/questions/67675102/getting-websocket-connection-to-ws-localhost7080-query-failed-on-connecting

@enisdenjo
Copy link
Owner

Hey there! A close event code 1006 indicates abrupt closure, in this case, due to the server terminating the connection.

If you are talking about this gqlgen, it does not support the GraphQL over WebSocket protocol this library implements. It, sadly, supports only the legacy protocol of subscriptions-transport-ws. Meaning, you must use the subscriptions-transport-ws with their backend.

You should maybe open an issue on their side since only they can resolve this.

@enisdenjo enisdenjo added the question Further information about the library is requested label May 24, 2021
@sagg155
Copy link
Author

sagg155 commented May 24, 2021

@enisdenjo , yeah i have used this gqlgen only but here in L65 of above github link it's written this "Sec-Websocket-Protocol": []string{"graphql-ws"}, so here it's mentioned graphql-ws. Am i understanding something wrong. So, what the meaning of this line "Sec-Websocket-Protocol": []string{"graphql-ws"},

@enisdenjo
Copy link
Owner

Seems like there is already an issue and an accompanying PR over at gqlgen.

@enisdenjo
Copy link
Owner

enisdenjo commented May 24, 2021

The subprotocol of the new GraphQL over WebSocket Protocol is graphql-transport-ws, graphql-ws belongs to subscriptions-transport-ws.

@sagg155
Copy link
Author

sagg155 commented May 24, 2021

@enisdenjo , thanks for helping, i was really frustated since last two days for this. I'll try subscriptions-transport-ws with this

@enisdenjo
Copy link
Owner

Sure thing, glad I could help. Best of luck!

@enisdenjo enisdenjo added unrelated Not relevant, related or caused by the lib and removed question Further information about the library is requested labels May 31, 2021
@theogravity
Copy link

theogravity commented Mar 4, 2022

The subprotocol of the new GraphQL over WebSocket Protocol is graphql-transport-ws, graphql-ws belongs to subscriptions-transport-ws.

The comment is a bit confusing. Do you mean that graphql-ws is using the graphql-transport-ws protocol, and the package name was formerly subscriptions-transport-ws?

When the client sends protocol information to the server, what should the value be? graphql-ws or graphql-transport-ws?

It looks like at one point graphql-ws used a different protocol before using graphql-transport-was?

(We're trying to troubleshoot issues around our gqlgen based server).

@enisdenjo
Copy link
Owner

enisdenjo commented Mar 5, 2022

The comment is a bit confusing. Do you mean that graphql-ws is using the graphql-transport-ws protocol

Yes, the subprotocol of the new GraphQL over WebSocket Protocol is graphql-transport-ws.

... and the package name was formerly subscriptions-transport-ws?

No, subscriptions-transport-ws is a completely different library that uses a different protocol.

When the client sends protocol information to the server, what should the value be? graphql-ws or graphql-transport-ws?

graphql-transport-ws.

It looks like at one point graphql-ws used a different protocol before using graphql-transport-was?

No, it was always graphql-transport-ws.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
unrelated Not relevant, related or caused by the lib
Projects
None yet
Development

No branches or pull requests

3 participants