graphql

2020-03-26T09:43:45.002Z

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

gklijs 2020-03-26T09:50:46.002200Z

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.

2020-03-26T10:17:30.002400Z

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

2020-03-26T10:17:58.002600Z

graphql is transport agnostic after all

2020-03-26T10:18:29.002800Z

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

2020-03-26T10:19:33.003Z

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

2020-03-26T10:20:14.003200Z

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

gklijs 2020-03-26T10:36:34.003400Z

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.

gklijs 2020-03-26T10:38:04.003600Z

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.

gklijs 2020-03-26T10:40:09.003800Z

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.

gklijs 2020-03-26T10:47:10.004Z

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

2020-03-26T10:51:55.004200Z

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

2020-03-26T10:52:39.004400Z

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

gklijs 2020-03-26T14:56:10.004600Z

Yes, it would be a nice improvement.

2020-03-26T15:49:08.005200Z

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

👏 3
hlship 2020-03-26T16:16:21.005800Z

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

5
2020-03-26T16:19:52.007100Z

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 🙂