python-graphql-client icon indicating copy to clipboard operation
python-graphql-client copied to clipboard

Support "graphql-transport-ws" websocket subprotocol

Open jenskdsgn opened this issue 2 years ago • 2 comments

For a project, where the server only accepts the graphql-transport-ws protocol, I would like to add the option to define a specific protocol behavior.

What kind of change does this PR introduce?

Feature

What is the current behavior?

Only graphql-ws subprotocol is supported

What is the new behavior?

graphql-ws is still the default protocol, but it can be configured to use "graphql-transport-ws" as well.

Does this PR introduce a breaking change?

No

Other information

The practical difference here between the protocols is only the command structure of the init command, which only affects the name of the type. ws-graphql names is start, graphql-transport-ws calls is subscription 🤷‍♂️

The risk of this PR is relatively low, but it makes the library backwards compatible with older implementations which is a good thing to have I guess.

Sorry for now writing tests, I am not that proficient in python, so I would appreciate a little help here.

Thanks

jenskdsgn avatar Jan 13 '23 16:01 jenskdsgn

@jenskdsgn thanks for the contribution could you by chance write some unit tests for ws_subprotocol?

xkludge avatar Jan 26 '23 18:01 xkludge

Yeah I can try 🙃

jenskdsgn avatar Jan 26 '23 18:01 jenskdsgn