Skip to content

Commit 9849736

Browse files
authored
Improve WebSocket integration (#1191, #1022)
- 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
1 parent a74ea9c commit 9849736

File tree

37 files changed

+620
-942
lines changed

37 files changed

+620
-942
lines changed

.github/workflows/ci.yml

+8-32
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ jobs:
2525
needs:
2626
- bench
2727
- clippy
28-
- example
2928
- feature
3029
- msrv
3130
- release-check
@@ -84,32 +83,6 @@ jobs:
8483
- run: cargo clippy -p juniper_benchmarks --benches -- -D warnings
8584
- run: cargo bench -p juniper_benchmarks
8685

87-
example:
88-
strategy:
89-
fail-fast: false
90-
matrix:
91-
example:
92-
- actix_subscriptions
93-
- basic_subscriptions
94-
- warp_async
95-
- warp_subscriptions
96-
os:
97-
- ubuntu
98-
- macOS
99-
- windows
100-
toolchain:
101-
- stable
102-
- beta
103-
- nightly
104-
runs-on: ${{ matrix.os }}-latest
105-
steps:
106-
- uses: actions/checkout@v4
107-
- uses: dtolnay/rust-toolchain@v1
108-
with:
109-
toolchain: ${{ matrix.toolchain }}
110-
111-
- run: cargo check -p example_${{ matrix.example }}
112-
11386
feature:
11487
strategy:
11588
fail-fast: false
@@ -161,8 +134,9 @@ jobs:
161134
- juniper_codegen
162135
- juniper
163136
- juniper_subscriptions
137+
- juniper_graphql_transport_ws
164138
- juniper_graphql_ws
165-
- juniper_actix
139+
#- juniper_actix
166140
- juniper_hyper
167141
#- juniper_iron
168142
- juniper_rocket
@@ -171,6 +145,10 @@ jobs:
171145
- ubuntu
172146
- macOS
173147
- windows
148+
include:
149+
- { msrv: "1.68.0", crate: "juniper_actix", os: "ubuntu" }
150+
- { msrv: "1.68.0", crate: "juniper_actix", os: "macOS" }
151+
- { msrv: "1.68.0", crate: "juniper_actix", os: "windows" }
174152
runs-on: ${{ matrix.os }}-latest
175153
steps:
176154
- uses: actions/checkout@v4
@@ -184,9 +162,6 @@ jobs:
184162
- run: cargo +nightly update -Z minimal-versions
185163

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

191166
package:
192167
if: ${{ startsWith(github.ref, 'refs/tags/juniper') }}
@@ -214,6 +189,7 @@ jobs:
214189
- juniper_codegen
215190
- juniper
216191
- juniper_subscriptions
192+
- juniper_graphql_transport_ws
217193
- juniper_graphql_ws
218194
- juniper_integration_tests
219195
- juniper_codegen_tests
@@ -342,6 +318,7 @@ jobs:
342318
- juniper_codegen
343319
- juniper
344320
- juniper_subscriptions
321+
- juniper_graphql_transport_ws
345322
- juniper_graphql_ws
346323
- juniper_actix
347324
- juniper_hyper
@@ -366,7 +343,6 @@ jobs:
366343
needs:
367344
- bench
368345
- clippy
369-
- example
370346
- feature
371347
- msrv
372348
- package

Cargo.toml

+1-5
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,14 @@
22
resolver = "1" # unifying Cargo features asap for Book tests
33
members = [
44
"benches",
5-
"examples/basic_subscriptions",
6-
"examples/warp_async",
7-
"examples/warp_subscriptions",
8-
"examples/actix_subscriptions",
95
"juniper_codegen",
106
"juniper",
117
"juniper_hyper",
128
"juniper_iron",
139
"juniper_rocket",
1410
"juniper_subscriptions",
15-
"juniper_graphql_ws",
1611
"juniper_graphql_transport_ws",
12+
"juniper_graphql_ws",
1713
"juniper_warp",
1814
"juniper_actix",
1915
"tests/codegen",

book/src/advanced/subscriptions.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,8 @@ async fn run_subscription() {
154154
Currently there is an example of subscriptions with [warp][warp], but it still in an alpha state.
155155
GraphQL over [WS][WS] is not fully supported yet and is non-standard.
156156

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

160160

161161

book/src/servers/warp.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@ juniper = "0.16.0"
1414
juniper_warp = "0.8.0"
1515
```
1616

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

19-
[graphiql]: https://github.com/graphql/graphiql
19+
[GraphiQL]: https://github.com/graphql/graphiql
20+
[GraphQL Playground]: https://github.com/prisma/graphql-playground
2021
[hyper]: https://hyper.rs/
2122
[warp]: https://crates.io/crates/warp
2223
[juniper_warp]: https://github.com/graphql-rust/juniper/tree/master/juniper_warp
23-
[example]: https://github.com/graphql-rust/juniper/blob/master/juniper_warp/examples/warp_server.rs
24+
[example]: https://github.com/graphql-rust/juniper/blob/master/juniper_warp/examples/subscription.rs

examples/README.md

-56
This file was deleted.

examples/actix_subscriptions/Cargo.toml

-21
This file was deleted.

examples/basic_subscriptions/Cargo.toml

-15
This file was deleted.

examples/warp_async/Cargo.toml

-17
This file was deleted.

examples/warp_async/src/main.rs

-104
This file was deleted.

examples/warp_subscriptions/Cargo.toml

-20
This file was deleted.

0 commit comments

Comments
 (0)