@@ -183,7 +183,7 @@ pub mod subscriptions {
183
183
SinkExt as _, Stream , StreamExt as _,
184
184
} ;
185
185
use juniper:: { GraphQLSubscriptionType , GraphQLTypeAsync , RootNode , ScalarValue } ;
186
- use juniper_graphql_transport_ws :: { ArcSchema , Init } ;
186
+ use juniper_graphql_ws :: { graphql_transport_ws , graphql_ws , ArcSchema , Init } ;
187
187
use tokio:: sync:: Mutex ;
188
188
189
189
/// Serves by auto-selecting between the
@@ -194,11 +194,10 @@ pub mod subscriptions {
194
194
/// The `schema` argument is your [`juniper`] schema.
195
195
///
196
196
/// The `init` argument is used to provide the custom [`juniper::Context`] and additional
197
- /// configuration for connections. This can be a
198
- /// [`juniper_graphql_transport_ws::ConnectionConfig`] if the context and configuration are
199
- /// already known, or it can be a closure that gets executed asynchronously whenever a client
200
- /// sends the subscription initialization message. Using a closure allows to perform an
201
- /// authentication based on the parameters provided by a client.
197
+ /// configuration for connections. This can be a [`juniper_graphql_ws::ConnectionConfig`] if the
198
+ /// context and configuration are already known, or it can be a closure that gets executed
199
+ /// asynchronously whenever a client sends the subscription initialization message. Using a
200
+ /// closure allows to perform an authentication based on the parameters provided by a client.
202
201
///
203
202
/// [new]: https://github.com/enisdenjo/graphql-ws/blob/v5.14.0/PROTOCOL.md
204
203
/// [old]: https://github.com/apollographql/subscriptions-transport-ws/blob/v0.11.0/PROTOCOL.md
@@ -262,8 +261,7 @@ pub mod subscriptions {
262
261
S : ScalarValue + Send + Sync + ' static ,
263
262
I : Init < S , CtxT > + Send ,
264
263
{
265
- let ( s_tx, s_rx) =
266
- juniper_graphql_ws:: Connection :: new ( ArcSchema ( schema) , init) . split :: < Message > ( ) ;
264
+ let ( s_tx, s_rx) = graphql_ws:: Connection :: new ( ArcSchema ( schema) , init) . split :: < Message > ( ) ;
267
265
268
266
let mut resp = ws:: start (
269
267
Actor {
@@ -285,10 +283,10 @@ pub mod subscriptions {
285
283
/// Serves the [new `graphql-transport-ws` GraphQL over WebSocket Protocol][new].
286
284
///
287
285
/// The `init` argument is used to provide the context and additional configuration for
288
- /// connections. This can be a [`juniper_graphql_transport_ws ::ConnectionConfig`] if the context
289
- /// and configuration are already known, or it can be a closure that gets executed
290
- /// asynchronously when the client sends the `ConnectionInit` message. Using a closure allows to
291
- /// perform an authentication based on the parameters provided by a client.
286
+ /// connections. This can be a [`juniper_graphql_ws ::ConnectionConfig`] if the context and
287
+ /// configuration are already known, or it can be a closure that gets executed asynchronously
288
+ /// when the client sends the `ConnectionInit` message. Using a closure allows to perform an
289
+ /// authentication based on the parameters provided by a client.
292
290
///
293
291
/// [new]: https://github.com/enisdenjo/graphql-ws/blob/v5.14.0/PROTOCOL.md
294
292
pub async fn graphql_transport_ws_handler < Query , Mutation , Subscription , CtxT , S , I > (
@@ -308,8 +306,8 @@ pub mod subscriptions {
308
306
S : ScalarValue + Send + Sync + ' static ,
309
307
I : Init < S , CtxT > + Send ,
310
308
{
311
- let ( s_tx, s_rx) = juniper_graphql_transport_ws :: Connection :: new ( ArcSchema ( schema ) , init )
312
- . split :: < Message > ( ) ;
309
+ let ( s_tx, s_rx) =
310
+ graphql_transport_ws :: Connection :: new ( ArcSchema ( schema ) , init ) . split :: < Message > ( ) ;
313
311
314
312
let mut resp = ws:: start (
315
313
Actor {
@@ -429,7 +427,7 @@ pub mod subscriptions {
429
427
fn into_ws_response ( self ) -> Result < String , ws:: CloseReason > ;
430
428
}
431
429
432
- impl < S : ScalarValue > IntoWsResponse for juniper_graphql_transport_ws :: Output < S > {
430
+ impl < S : ScalarValue > IntoWsResponse for graphql_transport_ws :: Output < S > {
433
431
fn into_ws_response ( self ) -> Result < String , ws:: CloseReason > {
434
432
match self {
435
433
Self :: Message ( msg) => serde_json:: to_string ( & msg) . map_err ( |e| ws:: CloseReason {
@@ -444,7 +442,7 @@ pub mod subscriptions {
444
442
}
445
443
}
446
444
447
- impl < S : ScalarValue > IntoWsResponse for juniper_graphql_ws :: ServerMessage < S > {
445
+ impl < S : ScalarValue > IntoWsResponse for graphql_ws :: ServerMessage < S > {
448
446
fn into_ws_response ( self ) -> Result < String , ws:: CloseReason > {
449
447
serde_json:: to_string ( & self ) . map_err ( |e| ws:: CloseReason {
450
448
code : ws:: CloseCode :: Error ,
@@ -456,7 +454,7 @@ pub mod subscriptions {
456
454
#[ derive( Debug ) ]
457
455
struct Message ( ws:: Message ) ;
458
456
459
- impl < S : ScalarValue > TryFrom < Message > for juniper_graphql_transport_ws :: Input < S > {
457
+ impl < S : ScalarValue > TryFrom < Message > for graphql_transport_ws :: Input < S > {
460
458
type Error = Error ;
461
459
462
460
fn try_from ( msg : Message ) -> Result < Self , Self :: Error > {
@@ -470,7 +468,7 @@ pub mod subscriptions {
470
468
}
471
469
}
472
470
473
- impl < S : ScalarValue > TryFrom < Message > for juniper_graphql_ws :: ClientMessage < S > {
471
+ impl < S : ScalarValue > TryFrom < Message > for graphql_ws :: ClientMessage < S > {
474
472
type Error = Error ;
475
473
476
474
fn try_from ( msg : Message ) -> Result < Self , Self :: Error > {
0 commit comments