Skip to content

Clone Context on each GraphQL subscription execution#1369

Merged
tyranron merged 5 commits intographql-rust:masterfrom
50U10FCA7:ws-context-clone
Mar 8, 2026
Merged

Clone Context on each GraphQL subscription execution#1369
tyranron merged 5 commits intographql-rust:masterfrom
50U10FCA7:ws-context-clone

Conversation

@50U10FCA7
Copy link
Copy Markdown
Contributor

Synopsis

Context in juniper_graphql_ws shared across multiple GraphQL subscriptions in same WebSocket connection, which causes problems with defining subscription-local data.

Solution

Clone Context for each GraphQL subscription in WebSocket connection. It will allow end-user to control the context scope:

  • If user still need to share context between multiple subscriptions - he just wraps the required data in Arc;
  • If user need to strict context scope to be subsciption-local - he just reset the required data in impl Clone for Context.

Checklist

  • Tests are added
  • Documentation is added (including Book)
  • CHANGELOG is filled

@50U10FCA7
Copy link
Copy Markdown
Contributor Author

50U10FCA7 commented Mar 5, 2026

FCM

Clone `Context` for each GraphQL subscription in `juniper_graphql_ws` crate (#1369)

tyranron added 2 commits March 8, 2026 18:22
# Conflicts:
#	juniper_actix/CHANGELOG.md
#	juniper_graphql_ws/CHANGELOG.md
@tyranron tyranron added enhancement Improvement of existing features or bugfix semver::breaking Breaking change in terms of SemVer k::api Related to API (application interface) k::design Related to overall design and/or architecture labels Mar 8, 2026
@tyranron tyranron added this to the 0.18.0 milestone Mar 8, 2026
@50U10FCA7
Copy link
Copy Markdown
Contributor Author

@tyranron Looks like I forgot to update trait bounds in tests. Can take the PR back to Draft to fix tests?

@tyranron tyranron enabled auto-merge (squash) March 8, 2026 21:45
@tyranron tyranron merged commit 2ed9d9d into graphql-rust:master Mar 8, 2026
181 checks passed
@50U10FCA7 50U10FCA7 deleted the ws-context-clone branch March 8, 2026 22:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Improvement of existing features or bugfix k::api Related to API (application interface) k::design Related to overall design and/or architecture semver::breaking Breaking change in terms of SemVer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants