Comments (6)
@dan-lee @kefniark PR welcome for lifting the constraint 😇 Sorry for causing the troubles, we discussed it internally ans we dont see why we should not allow it for now, as the official spec is still pretty vague (aka non-existing 😅)!
Slightly related: I would also appreciate any comments and thoughs on graphql/graphql-over-http#167
from graphql-helix.
As mentioned on discord we never intended graphql-helix to be compatible with the protocol described via graphql-sse
. The prior compatibility has been a pure coincidence.
The API for communicating with an SSE endpoint in browsers is EventSource. The EventSource ALWAYS sends a GET request to the SSE endpoint. There is no "official" SSE over HTTP spec yet. We made the assumption that SSE MUST be done over GET, however, this is assumption was wrong as the SSE specification does not really dictate the HTTP verb that should be used. It also seems like using GET for SSE is the common sense people agreed upon.
I don't really have an answer for this. I guess it might make sense to let people configure whether subscriptions are allowed via GET and/or POST?
This should probably also be a discussion on the GraphQL over HTTP repository
from graphql-helix.
Same here, using graphql-sse
on few projects and running into the same issue.
I'm a bit confused by such modification, it looks quite arbitrary to me to enforce Get over Post for SSE Subscription, and I thought the whole point of graphql-helix was to be
Framework and runtime agnostic. Use whatever HTTP library you want
Anyway, as a workaround I just did what I was already doing with apollo before, moving the subscription out of the graphql-helix endpoint, and use a dedicated subscription endpoint managed by graphql-sse
directly
// graphql-helix on `/graphql`
this.app.use(`/graphql`, async (req, res) => {
const request = { body: req.body, headers: req.headers, method: req.method, query: req.query }
// ... graphql-helix code
sendResult(result, res, formatResult)
})
// graphql-sse on `/stream`
const handler = createHandler({ schema, context: (req: Request) => ({ db, pubsub, req }) })
this.app.use(`/stream`, [...middlewares], handler)
and on client side, the only modification is to change the subscription url.
from graphql-helix.
@kefniark My problem is that I am using Cloudflare Workers and the graphql-sse
server handler relies on Node.js Request/Response APIs.
I don't really have an answer for this. I guess it might make sense to let people configure whether subscriptions are allowed via GET and/or POST?
@n1ru4l I think that would be best for now instead of closing the door completely.
I also think this needs a broader discussion to provide a more common standard.
from graphql-helix.
@n1ru4l I've opened PR #225 :)
from graphql-helix.
Fixed in v1.12.0
from graphql-helix.
Related Issues (20)
- proposal: merge PUSH and MULTIPART_RESPONSE into STREAM
- Avoid bundling GraphiQL HOT 3
- processRequest does not support multiple accept types HOT 2
- FastifyError: Promise may not be fulfilled with 'undefined' when statusCode is not 204 HOT 1
- Fastify example - cannot set cookies HOT 5
- missing exports `send ... ResponseResult` from `node-http` in the barrel file
- Error: Cannot find module `<path>\node_module\graphql-helix\dist\dist.js` HOT 3
- Helix in Gateway to pass headers down to subschema? HOT 1
- graphql-ws example: Invalid query returns "Subscriptions should be sent over WebSocket" HOT 2
- Slow processRequest when error thrown HOT 1
- graphql-koa-example: subscriptions not working
- [Question] Have you thought about graphql-jit? HOT 2
- Adding `extensions` to `GraphQLParams`
- Is development dead? Zero commits since The Guild announced Yoga 2. HOT 1
- Infinite loop when using defer and async iterators (`JavaScript heap out of memory`)
- Can we detect/support cancelation of @stream operations?
- typescript compilation errors
- Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client HOT 1
- Before and after crud operation listeners
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from graphql-helix.