graphql

hlship 2020-07-02T00:26:56.220500Z

So, yes, I could imagine supporting queries and mutations that way, but I haven't kept familiar with the Apollo approach, and there's the question of how to manage the conversation; as in, with a resolver, rather than a streamer, will likely want to send a single response to the client.

👍 1
🎉 1
domkm 2020-07-02T00:39:22.223900Z

The details of query and mutation over websocket seem to be in the spec https://github.com/apollographql/subscriptions-transport-ws/blob/master/PROTOCOL.md#connected-phase. It looks like the client sends gql_start and the server responds with gql_data followed by gql_stop. gql_start seems to not be specific to subscriptions. Regarding execution, it could use the normal functionality. The only changes needed for resolvers is that they might need to look in connection params for auth info instead of HTTP headers.

2020-07-02T07:39:35.225100Z

I think lacinia-pedestal already does support this, we are using it currently

2020-07-02T07:40:40.226800Z

That's how I wrote re-graph, and I was surprised to learn that most graphql servers don't support it, because it seems like such an easy thing to do

2020-07-02T07:45:50.228400Z

You just send start with a query (instead of subscription) and lacinia responds with one response and stops, see https://github.com/oliyh/re-graph/blob/master/src/re_graph/core.cljc#L73

2020-07-02T07:46:32.228900Z

Exactly as described in your link @domkm

domkm 2020-07-02T14:07:54.230Z

@oliy Cool! I assumed otherwise because the docs say "Subscriptions are processed on a second endpoint; normal requests continue to be sent to /api, but subscription requests must use /ws". Glad to hear otherwise. Thanks.

2020-07-02T14:12:54.230500Z

:)

hlship 2020-07-02T16:59:42.233600Z

It's funny for me to learn something about Lacinia; I don't know/remember if it is intentional or not that you can perform queries in the subscriptions web socket!

🙂 1
gklijs 2020-07-02T16:59:46.233900Z

Most don't, but micronaut-graphql does, Exactly because it's easy. The library with the protocol might move to the guild. Also aws has a protocol with some additions, like a subscription ack.

hlship 2020-07-02T16:59:49.234100Z

I'll check to see if I left some tests behind.

gklijs 2020-07-02T17:01:45.235100Z

Most like kotlin-graphql, just implement the subscription part of the protocol.