-
Notifications
You must be signed in to change notification settings - Fork 19
How can I get GraphQL subscriptions working? #247
Comments
How does your server schema look like? The current instances only allow you yo have subscriptions also if you have queries, but there's nothing technical stopping us from creating one only for subscriptions. |
It's about 2 existing But I can use graphql subscriptions "in general" - I mean, on the client-side. |
Usually that means you are asking for subscriptions via HTTP. You need to use a streaming transport, such as WebSockets, to make it work. In most cases, it's as easy as changing |
I am actually not sure how it works over HTTP, if you know of a good pointer to the spec. we could consider adding that support. |
For example, Apollo requires WebSockets, see the last line in the code block here |
There is a GraphQL over WebSocket Protocol. I would like to mention it here as long as it's related to the topic. But I still can't figure out how to run subscriptions on existing examples (they are supposed to be working over |
Something weird is indeed happening, and I don't know what it is. The code for accepting the connection works OK (I added a few Unfortunately, I think we really need to dig deeper, maybe writing a few examples using the |
git checkout bfdf5f4 git clean -dxf
stack run library-graphql Running the simplest example with ...and it still doesn't work. Do I understand right that it's because dependencies are not specified by their exact versions? |
I don’t think so, there seems to be some problem on the way we use
websockets, which somehow worked on previous versions. We would need to
test the example against the LTS 14 and see whether that works on that
environment.
|
There are 2 GraphQL examples, and there are 2 instances of
RunDocument
ingraphql/src/Mu/GraphQL/Query/Run.hs
which require(Proxy @('Just sub))
.library
example (the one with DB) uses one instance (let's call itinstance A
)library-graphql
example (without DB) uses another instance (let's call itinstance B
)Both examples return
cannot execute subscriptions in this wire
.I don't quite understand which instance should I aim to use (If I understand it right, there are only 2 for subscriptions defined).
Clients I tried to use:
Queries:
library
library-graphql
(Though I suppose it's a server-side issue, not a client-side).
Please help me understand.
The text was updated successfully, but these errors were encountered: