Skip to content
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

Enable Subscription Functionality for GraphiQL-Explorer #1125

Merged
merged 15 commits into from
Oct 25, 2023

Conversation

fabiangfd
Copy link
Contributor

The way GraphiQL-Explorer is currently initialized by Ariadne, subscriptions do not work.

This pull request allows to set the subscription endpoint (to be used by GraphiQL) manually via a subscription_url-parameter, which defaults to a websocket connection at the location of the graphiql-explorer (e.g., ws://localhost:8000/graphql/, if the explorer is reached via http://localhost:8000/graphql/).

@rafalp
Copy link
Contributor

rafalp commented Oct 23, 2023

Tests are failing. Can you fix them?

@codecov
Copy link

codecov bot commented Oct 24, 2023

Codecov Report

Merging #1125 (e386d27) into master (48fd7c7) will increase coverage by 0.00%.
The diff coverage is 100.00%.

❗ Current head e386d27 differs from pull request most recent head 3cfd93b. Consider uploading reports for the commit 3cfd93b to get more accurate results

@@           Coverage Diff           @@
##           master    #1125   +/-   ##
=======================================
  Coverage   97.82%   97.82%           
=======================================
  Files         115      115           
  Lines        7763     7767    +4     
=======================================
+ Hits         7594     7598    +4     
  Misses        169      169           
Files Coverage Δ
ariadne/explorer/graphiql.py 100.00% <ø> (ø)
tests/asgi/snapshots/snap_test_explorer.py 100.00% <ø> (ø)
tests/explorers/snapshots/snap_test_explorers.py 100.00% <100.00%> (ø)
tests/explorers/test_explorers.py 100.00% <100.00%> (ø)
tests/wsgi/snapshots/snap_test_explorer.py 100.00% <ø> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@fabiangfd
Copy link
Contributor Author

OK, I have fixed the tests: Added the new expected html from graphiql-explorer to the test snapshots.

@rafalp
Copy link
Contributor

rafalp commented Oct 24, 2023

There's also a test for passing options to graphiQL explorer. Can you add one more for custom subscription url?

https://github.com/mirumee/ariadne/blob/master/tests/explorers/test_explorers.py#L19

@fabiangfd
Copy link
Contributor Author

@rafalp rafalp added enhancement New feature or request roadmap Feature that we want to have included docs Focused on documentation contents labels Oct 25, 2023
@rafalp rafalp added this to the Next release milestone Oct 25, 2023
@rafalp rafalp merged commit b468817 into mirumee:master Oct 25, 2023
@rafalp
Copy link
Contributor

rafalp commented Oct 25, 2023

Thank you for contributing. This will need to have an changelog entry and documentation updated, but I'll handle those before next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Focused on documentation contents enhancement New feature or request roadmap Feature that we want to have included
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants