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
Support Websockets #17
Comments
There's no de-facto standard for GraphQL over Websockets, not even for subscriptions. That being said, in v0.3+ we do support subscriptions:
Unfortunately the docs aren't quite ready yet, but v0.3 is available as a prerelease. And if you'd like to implement some kind of custom transport layer, in v0.3 we now have "exchanges" which are kind of like Apollo's links. We even have an experimental package that allows you to use apollo-links with urql: http://github.com/kitten/urql-exchange-apollo There's also no docs for that yet either (sorry) but here's an example snippet: https://twitter.com/_philpl/status/996325272009011200 So all in all v0.3 supports these custom usages 👍 Hope that works for you. Please let us know |
@kitten Not opening a new issue since the answer might be "write your own exchange", but I've noticed that the Would supporting this be difficult? I see that currently the |
@mjadczak It wouldn't be hard to make this happen per se, but it relies a lot on how the server and That being said this would definitely be a candidate for a new exchange package, i.e. |
😛 I get it though. Sounds like a candidate for a "help wanted" issue then? Could you reopen this one, or shall I file a new one? |
@mjadczak we don't plan to add all exchanges to this main repository and instead want more of them to be build separately. So feel free to get started on one and reach out to me directly if you need any help 👍 In the future we might convert this repo to a mono repo to accommodate for more packages though, although we'd prefer not to do this just yet 🙂 |
Any updates on this? Would be really cool if we can send other forms of queries (Mutations etc...) via websocket |
@AlaaZorkane Three year old issues aren't really insightful. you may want to check this though ✌️🤗https://formidable.com/open-source/urql/docs/advanced/subscriptions/ |
Thanks! I actually always have that page open I don't know how I missed that part lol, appreciate the fast response 🙌 |
A tiny brief history: https://twitter.com/seanybingbong/status/958359534615056394
Currently I'm able to do all of my GraphQL transactions via websockets with Apollo Link like so:
I already need a websocket connection for my app so I thought I could use it to do all my GraphQL transactions since GraphQL doesn't care about transport. My app hardly has any Apollo-specific, so I thought I'd give urql a shot, but I'd still like to keep using websockets since the timing benefits over HTTP are nice (though, somewhat unnoticeable).
Maybe doing something like
url: "wss://path.to/socket"
in urql would trigger the use of websockets?The text was updated successfully, but these errors were encountered: