Fork me on GitHub
#graphql
<
2020-03-26
>
oliy09:03:45

hi all, i've had to field a few questions about subscriptions in lacinia-pedestal in re-graph, i feel the documentation on how to set up subscriptions, especially the relationship between streamers, resolvers and source-stream could be improved. here's the latest which I believe I answered correctly: https://github.com/oliyh/re-graph/issues/64

gklijs09:03:46

Mutations over websocket is a bit of weird one, just like queries. Some servers and clients support them and other don't. And it's often not clear.

oliy10:03:30

oh i didn't realise that. i see no reason why queries and mutations couldn't take place over any transport - http, websocket, channels etc

oliy10:03:58

graphql is transport agnostic after all

oliy10:03:29

websockets should give you lower latency, avoid duplication of authentication etc

oliy10:03:33

but regardless of what should be, if you are telling me that some servers only support subs over websocket but that queries and mutations must go via http, then this might be something that re-graph should support

oliy10:03:14

this is something i didn't realise and i've spent a long time trying to tell people their servers are wrong 😢

gklijs10:03:34

Yes, that's my opinion as well. But graphql-java and kotlin-graphql see it differently. The crazy thing is the mutation/query is excecuted but the result is never send to the client.. As far as I've seen usages of the appollo client it also seems to use websockets just for subscriptions.

gklijs10:03:04

It took me some time what was going wrong when trying out those server libraries as well. It would be great if in time there was a better spec for graphql over websockets, and with that some tools to test server implementations.

gklijs10:03:09

I think re-graph does it right, for those other servers I could easily change the code to support multiple endpoints. The guild is also trying to get ownership of the code that contains the Protocol most use.

gklijs10:03:10

It's also pretty easy, to make it work with queries and mutations. Micronaut-graphql does support queries and mutations over websockets.

oliy10:03:55

The GraphQL spec says virtually nothing about subscriptions, it seems like the defacto standard is Apollo because they do things first

oliy10:03:39

It would be a small change in re-graph to add an option to specify which messages go over which transport

gklijs14:03:10

Yes, it would be a nice improvement.

oliy15:03:08

I wrote about my DataLoader library superlifter on a blog for Juxt: https://juxt.pro/blog/posts/superlifter.html

👏 12
hlship16:03:21

I'm still working to get our DataLoader library open sourced. Big companies, bureaucracy, sheesh!

party-corgi 20
oliy16:03:52

i have worked for clients that have a blanket ban on OS work on company time, so the fact you can do any at all is pretty good from that point of view 🙂