Giter Club home page Giter Club logo

Comments (7)

sjparsons avatar sjparsons commented on May 4, 2024 2

This is a fascinating idea. I really like it. I can also see that it'd be nice to see a standard around this mechanism. I'm thinking it'd be best for this to be post-1.0 release. What do you think?

from graphql-over-http.

sungam3r avatar sungam3r commented on May 4, 2024

sometimes this feature can come in handy

from graphql-over-http.

imolorhe avatar imolorhe commented on May 4, 2024

@benjie do you have a simple GraphQL server repo that has this implemented for demo purposes? I've been finding it hard to see this implementation actually working

from graphql-over-http.

benjie avatar benjie commented on May 4, 2024

No; but it is implemented in a separate small file:

https://github.com/graphile/postgraphile/blob/0ad482d5f9c4e8314d86f0ffc9f12d9e320578b1/src/postgraphile/http/setupServerSentEvents.ts

(Some of this file handles the differences between Koa and Express/Connect, so you may be able to trim a fair bit of it.)

That file is called from a middleware with this code:

      // Setup an event stream so we can broadcast events to graphiql, etc.
      if (pathname === '/graphql/stream') {
        if (req.headers.accept !== 'text/event-stream') {
          res.statusCode = 405;
          res.end();
          return;
        }
        setupServerSentEvents(req, res, options);
        return;
      }

The other thing is we have an EventEmitter and when the GraphQL schema has changed we publish the schemas:changed event to it; but your implementation may do something different.

from graphql-over-http.

benjie avatar benjie commented on May 4, 2024

Definitely post 1.0 is fine. It’d be optional anyhow.

from graphql-over-http.

acao avatar acao commented on May 4, 2024

@enisdenjo what do you think of adopting this for graphql-http? would you be open to a PR that allows the user to opt into this for NODE_ENV=development or whatever they configure? or should it come as a separate middleware?

I would like to implement this for the editor tooling (LSP server and GraphiQL), finally!

from graphql-over-http.

enisdenjo avatar enisdenjo commented on May 4, 2024

What exactly? Add the header? I don't think it's necessary to integrate this into the library as it can simply be added by the user itself.

from graphql-over-http.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.