ecthiender / py-graphql-client

Dead-simple GraphQL client with subscriptions over websockets
https://pypi.org/project/py-graphql-client/
Other
37 stars 11 forks source link

add graphql-ws as sub-protocol while connecting (fix #1) #8

Closed SalmonMode closed 5 years ago

SalmonMode commented 5 years ago

Closes #1

Now passes the "Sec-WebSocket-Protocol: graphql-ws" in the initial connection, which should fix connecting over the WSS:// protocol for some servers.

I also updated the changelog and readme files to reflect this

ecthiender commented 5 years ago

@SalmonMode thanks for the PR. I will test this out and then merge it. Probably won't be today, but I will get to it as soon as I can.

SalmonMode commented 5 years ago

I actually just found that the underlying websocket client is already looking for a subprotocols argument that creates that specific header, so I changed it to use that instead of just passing it as a complete header.

ecthiender commented 5 years ago

@SalmonMode sorry for the delay. I finally got time to test this. Turns out the websocket client library already supports wss, and we don't have to do anything. But your change to add the sub-protocol is useful though, so I am interested in merging this. But it would be better if can you change the commit messages, the PR message, changelog, readme etc. to reflect that (something like add graphql-ws sub-protocol...).

SalmonMode commented 5 years ago

you got it! All edited!

ecthiender commented 4 years ago

@SalmonMode sorry for the extreme delay! I have merged this and release a new beta version.

Install via: pip install py-graphql-client==0.1.1b1

Once you confirm it all works, I will publish a stable version (0.1.1).