Skip to content

Commit

Permalink
Improve WebSocket integration (#1191, #1022)
Browse files Browse the repository at this point in the history
- consider `juniper_graphql_transport_ws` crate on CI
- implement auto-selection of protocol in `juniper_warp` crate
- support `graphql-transport-ws` protocol in  `juniper_actix` crate
- implement auto-selection of protocol in `juniper_actix` crate

Additionally:
- move `examples/warp_subscriptions` into `juniper_warp/examples/subscription.rs`
- move `examples/actix_subscriptions` into `juniper_actix/examples/subscription.rs`
- move `examples/basic_subscriptions` into `juniper_subscriptions/examples/basic.rs`
- bump up MSRV of `juniper_actix` crate to 1.68
  • Loading branch information
tyranron committed Sep 21, 2023
1 parent a74ea9c commit 9849736
Show file tree
Hide file tree
Showing 37 changed files with 620 additions and 942 deletions.
40 changes: 8 additions & 32 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ jobs:
needs:
- bench
- clippy
- example
- feature
- msrv
- release-check
Expand Down Expand Up @@ -84,32 +83,6 @@ jobs:
- run: cargo clippy -p juniper_benchmarks --benches -- -D warnings
- run: cargo bench -p juniper_benchmarks

example:
strategy:
fail-fast: false
matrix:
example:
- actix_subscriptions
- basic_subscriptions
- warp_async
- warp_subscriptions
os:
- ubuntu
- macOS
- windows
toolchain:
- stable
- beta
- nightly
runs-on: ${{ matrix.os }}-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@v1
with:
toolchain: ${{ matrix.toolchain }}

- run: cargo check -p example_${{ matrix.example }}

feature:
strategy:
fail-fast: false
Expand Down Expand Up @@ -161,8 +134,9 @@ jobs:
- juniper_codegen
- juniper
- juniper_subscriptions
- juniper_graphql_transport_ws
- juniper_graphql_ws
- juniper_actix
#- juniper_actix
- juniper_hyper
#- juniper_iron
- juniper_rocket
Expand All @@ -171,6 +145,10 @@ jobs:
- ubuntu
- macOS
- windows
include:
- { msrv: "1.68.0", crate: "juniper_actix", os: "ubuntu" }
- { msrv: "1.68.0", crate: "juniper_actix", os: "macOS" }
- { msrv: "1.68.0", crate: "juniper_actix", os: "windows" }
runs-on: ${{ matrix.os }}-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -184,9 +162,6 @@ jobs:
- run: cargo +nightly update -Z minimal-versions

- run: make test.cargo crate=${{ matrix.crate }}
if: ${{ !contains(fromJSON('["juniper_actix"]'), matrix.crate) }}
- run: cargo check -p ${{ matrix.crate }} --all-features
if: ${{ contains(fromJSON('["juniper_actix"]'), matrix.crate) }}

package:
if: ${{ startsWith(github.ref, 'refs/tags/juniper') }}
Expand Down Expand Up @@ -214,6 +189,7 @@ jobs:
- juniper_codegen
- juniper
- juniper_subscriptions
- juniper_graphql_transport_ws
- juniper_graphql_ws
- juniper_integration_tests
- juniper_codegen_tests
Expand Down Expand Up @@ -342,6 +318,7 @@ jobs:
- juniper_codegen
- juniper
- juniper_subscriptions
- juniper_graphql_transport_ws
- juniper_graphql_ws
- juniper_actix
- juniper_hyper
Expand All @@ -366,7 +343,6 @@ jobs:
needs:
- bench
- clippy
- example
- feature
- msrv
- package
Expand Down
6 changes: 1 addition & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,14 @@
resolver = "1" # unifying Cargo features asap for Book tests
members = [
"benches",
"examples/basic_subscriptions",
"examples/warp_async",
"examples/warp_subscriptions",
"examples/actix_subscriptions",
"juniper_codegen",
"juniper",
"juniper_hyper",
"juniper_iron",
"juniper_rocket",
"juniper_subscriptions",
"juniper_graphql_ws",
"juniper_graphql_transport_ws",
"juniper_graphql_ws",
"juniper_warp",
"juniper_actix",
"tests/codegen",
Expand Down
4 changes: 2 additions & 2 deletions book/src/advanced/subscriptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ async fn run_subscription() {
Currently there is an example of subscriptions with [warp][warp], but it still in an alpha state.
GraphQL over [WS][WS] is not fully supported yet and is non-standard.

- [Warp Subscription Example](https://github.com/graphql-rust/juniper/tree/master/examples/warp_subscriptions)
- [Small Example](https://github.com/graphql-rust/juniper/tree/master/examples/basic_subscriptions)
- [Warp Subscription Example](https://github.com/graphql-rust/juniper/tree/master/juniper_warp/examples/subscription.rs)
- [Small Example](https://github.com/graphql-rust/juniper/tree/master/juniper_subscriptions/examples/basic.rs)



Expand Down
7 changes: 4 additions & 3 deletions book/src/servers/warp.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ juniper = "0.16.0"
juniper_warp = "0.8.0"
```

Included in the source is a [small example][example] which sets up a basic GraphQL and [GraphiQL] handler.
Included in the source is a [small example][example] which sets up a basic GraphQL and [GraphiQL]/[GraphQL Playground] handlers with subscriptions support.

[graphiql]: https://github.com/graphql/graphiql
[GraphiQL]: https://github.com/graphql/graphiql
[GraphQL Playground]: https://github.com/prisma/graphql-playground
[hyper]: https://hyper.rs/
[warp]: https://crates.io/crates/warp
[juniper_warp]: https://github.com/graphql-rust/juniper/tree/master/juniper_warp
[example]: https://github.com/graphql-rust/juniper/blob/master/juniper_warp/examples/warp_server.rs
[example]: https://github.com/graphql-rust/juniper/blob/master/juniper_warp/examples/subscription.rs
56 changes: 0 additions & 56 deletions examples/README.md

This file was deleted.

21 changes: 0 additions & 21 deletions examples/actix_subscriptions/Cargo.toml

This file was deleted.

15 changes: 0 additions & 15 deletions examples/basic_subscriptions/Cargo.toml

This file was deleted.

17 changes: 0 additions & 17 deletions examples/warp_async/Cargo.toml

This file was deleted.

104 changes: 0 additions & 104 deletions examples/warp_async/src/main.rs

This file was deleted.

20 changes: 0 additions & 20 deletions examples/warp_subscriptions/Cargo.toml

This file was deleted.

Loading

0 comments on commit 9849736

Please sign in to comment.