Fork me on GitHub
#graphql
<
2020-07-02
>
hlship00:07:56

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.

👍 3
🎉 3
domkm00:07:22

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.

oliy07:07:35

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

oliy07:07:40

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

oliy07:07:50

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

oliy07:07:32

Exactly as described in your link @domkm

domkm14:07:54

@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.

hlship16:07:42

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!

🙂 3
gklijs16:07:46

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.

hlship16:07:49

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

gklijs17:07:45

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