Skip to content

GraphiQL setup to support websockets #131

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jamesmmchugh opened this issue Sep 16, 2021 · 2 comments
Closed

GraphiQL setup to support websockets #131

jamesmmchugh opened this issue Sep 16, 2021 · 2 comments
Assignees
Labels
in: web Issues related to web handling type: enhancement A general enhancement
Milestone

Comments

@jamesmmchugh
Copy link

GraphiQL has utilities for creating fetchers for both HTTP and WS, currently the spring-graphql setup of GraphiQL only supports a HTTP meaning subscriptions over websocket cannot be tested via the UI:

For example, see: https://github.com/graphql/graphiql/blob/main/packages/graphiql-toolkit/docs/create-fetcher.md

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Sep 16, 2021
@bclozel
Copy link
Member

bclozel commented Sep 16, 2021

Interesting!
How does that materialize in the GraphiQL interface? Is there a live sample demonstrating this feature?

@jamesmmchugh
Copy link
Author

I'm not aware of any live samples. It's quite easy to test by overriding the index.html that this boot project serves for GraphiQL. I can provide a copy of what I used if desired.

When using, GraphiQL displays the lastest message in the the query output section. Any further analysis of the websocket connection can be done in the browers debugger.

GraphiQL lets you run a single subscription at a time, and terminates the websocket connection at when the subscription completes. It also turns the run button into a stop button so you can terminate the subscription early if desired.

jvalkeal added a commit to jvalkeal/spring-graphql that referenced this issue Nov 27, 2021
- Drop existing single page cdn integration from boot project.
- Create new `spring-graphql-graphiql` module containing `graphiql` integration.
- Makes `graphiql` optional which user can pull in as a dependency.
- `spring-graphql-graphiql` is a basic npm module which packages itself as
  a jar where boot autoconfig can integrate to.
- In a npm module graphiql itself is handled as a plain react app which allows
  some customisation like setting logo name to demonstrate how things are passed
  from boot properties into a react app itself.
- GraphiQlHandler's are changed to handle all traffic into `/graphiql` order to:
  - Handling main html in `/graphiql/explorer`
  - Redirect to `/graphiql/explorer` to get context path under `/graphiql/`
  - Handle `main.js` from classpath to get html to load it under `/graphiql/`
  - Handle `config.js` as a way to pass configuration options from server side
    and load those into react app. There are various long threads in GH and SO
    discussing this problem and I chose to load settings from a server side.
- Samples webmvc-http and webflux-websocket are changed to use this module.
  - `webmvc-http` is as it used to be.
  - `webflux-websocket` can now use subscription which gets first greeting instead
    of subscription request reply.
- Fixes spring-projects#20
- Fixes spring-projects#131
jvalkeal added a commit to jvalkeal/spring-graphql that referenced this issue Nov 28, 2021
- Drop existing single page cdn integration from boot project.
- Create new `spring-graphql-graphiql` module containing `graphiql` integration.
- Makes `graphiql` optional which user can pull in as a dependency.
- `spring-graphql-graphiql` is a basic npm module which packages itself as
  a jar where boot autoconfig can integrate to.
- In a npm module graphiql itself is handled as a plain react app which allows
  some customisation like setting logo name to demonstrate how things are passed
  from boot properties into a react app itself.
- GraphiQlHandler's are changed to handle all traffic into `/graphiql` order to:
  - Handling main html in `/graphiql/explorer`
  - Redirect to `/graphiql/explorer` to get context path under `/graphiql/`
  - Handle `main.js` from classpath to get html to load it under `/graphiql/`
  - Handle `config.js` as a way to pass configuration options from server side
    and load those into react app. There are various long threads in GH and SO
    discussing this problem and I chose to load settings from a server side.
- Samples webmvc-http and webflux-websocket are changed to use this module.
  - `webmvc-http` is as it used to be.
  - `webflux-websocket` can now use subscription which gets first greeting instead
    of subscription request reply.
- Fixes spring-projects#20
- Fixes spring-projects#131
@bclozel bclozel added in: web Issues related to web handling type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Dec 2, 2021
@bclozel bclozel added this to the 1.0.0-M4 milestone Dec 2, 2021
@rstoyanchev rstoyanchev modified the milestones: 1.0.0-M4, 1.0.0-M5 Dec 9, 2021
@bclozel bclozel self-assigned this Jan 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues related to web handling type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants