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

Missing GQL_CONNECTION_INIT message in Subscriptions #32

Closed
Amzd opened this issue Apr 13, 2021 · 1 comment
Closed

Missing GQL_CONNECTION_INIT message in Subscriptions #32

Amzd opened this issue Apr 13, 2021 · 1 comment

Comments

@Amzd
Copy link
Contributor

Amzd commented Apr 13, 2021

We did not send the GQL_CONNECTION_INIT message when creating a websocket which meant a server would not start sending keepalive messages. Not sure why the websocket doesn't time out in the example but it does for me in production.

I have a quick fix ready but the subscription part should be rebuilt to use only a single websocket for multiple queries to the same server.

@Amzd
Copy link
Contributor Author

Amzd commented Apr 19, 2021

Okay so I've done a bit more research on this issue.

There is two main websocket protocols that are really being used.

  1. https://github.com/apollographql/subscriptions-transport-ws/blob/master/PROTOCOL.md

Appollos protocol which extremely loosely defines what messages can be sent but with very little detail on what should happen when the client sends undefined messages. It also doesn't mention authorization (maybe assuming that is sent in the request headers?) but since it's not defined, some libraries require it in the headers and some in the connection_init payload.

  1. https://github.com/enisdenjo/graphql-ws/blob/master/PROTOCOL.md

This protocol defines way more specific what will happen when certain messages are sent and Apollo is moving to this right now: graphql/graphql-playground#1295

I originally based my subscriptions on the first protocol but we should look at supporting the new protocol, possibly with backwards compatibility.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants