graphql-python / gql

A GraphQL client in Python

Home Page:https://gql.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gql should have a websockets-client transport

mpegman-scwx opened this issue · comments

python-websockets doesn't support proxies and has no intention to in the near future. We should allow for usage of a websockets-client transport to allow users to ability to run through proxies.

I plan on working on this myself. Just creating a placeholder issue to work off of, but I am willing to work with anyone else that would be interested in supporting this feature.

  • Wouldn't it be better to make a new websockets transport using aiohttp as proposed by #418 instead of using adding a new websockets-client dependency?

  • Have you looked into this comment for a way to make a websocket connection through a proxy using websockets?

I was looking through aiohttp docs and everything there uses the async keyword. It would be nice to have a websockets option that supported proxies and didn't need event loop management.

Well, the great thing about gql is that you can use any transport (sync or async) in a sync way if you want. If you look at the default subscription example, you don't see any async code there.

And what about the method in the comment above? Can't it solve your problem?

It's worth to looking into, but at the moment hasn't been implemented yet. It would take me some time to familiarize myself with aiohttp (something I haven't used at all and don't know any of its internals). Looking through the subscribe() method it looks like it needs an async transport anyways, so maybe this wouldn't even integrate well.