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

web socket protocol confusion #388

Open
tintin10q opened this issue Jan 11, 2024 · 1 comment
Open

web socket protocol confusion #388

tintin10q opened this issue Jan 11, 2024 · 1 comment

Comments

@tintin10q
Copy link

tintin10q commented Jan 11, 2024

Hey there, I have generated a client with --subscriptions graphql-ws . I am also using hasura subscription and I want to migrate from my apolo subscription client to the zeus one.

When I look at the messages that this client generates I get:

{"id":"c1a9e1a2-60b6-4cad-b6a8-b031449f8280","type":"subscribe","payload":"..........."}

But the old apolloclient actually sends a message like this:

{"id":"1","type":"start","payload":"...."}

So instead of a message with type subscribe it sends a message with type start.

I looked in the protocol description: https://github.com/enisdenjo/graphql-ws/blob/master/PROTOCOL.md

But the zeus actually seems to be the right one. There is no mention of a start message. So it seems that apollo used a different protocol.

So can someone please tell me what protocol the protocol using the start message is. I tried to look but I couldn't find it.

@gthau
Copy link

gthau commented Feb 16, 2024

Be wary of the confusing names of the protocols and libraries...

There are 2 graphql subscriptions protocols over WebSocket:

Which one to use depends what your gql server implements and whether you are limited by 3rd party libs that support one or the other, e.g. older versions of apollo client don't support graphql-transport-ws, or Zeus doesn't support graphql-ws. Note that on the server-side, you can support both of them (it might require a fair amount of debugging to get it right depending on your server's solution).
If you use Zeus generated client, then you have to support graphql-transport-ws on your server-side (I haven't looked at stucco, I don't how standard/non-standard it is).

The first part of this article does a good job presenting the differences between both protocols.

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