A common use-case is for servers to support both simultaneously and negotiate the correct protocol to use on each connection, as discussed in https://github.com/seanmonstar/warp/issues/760. To support that use-case, we can't force the users into one or the other at compile-time.
I also think the changes, while relatively minor, are pervasive enough that it makes switching between the protocols via conditionals very messy and hard to follow.
Following this, as we aim to support both protocols in our HTTP integration crates, both juniper_graphql_transport_ws and juniper_graphql_ws crates are always used and depend on each other, which makes a little sense to support them a separate crates.
Solution
Instead, it's enough to keep only one juniper_graphql_ws crate, where support both protocols via additive Cargo features. This will simplify maintenance and usage costs, while allowing to reuse similar types naturally, giving the desired level of polymorphism for supporting both protocols at the same time.
Part of #1022
Resolves #1186 Follows #1158, #1191
Motivation
Despite the raised concern for the initial implementation https://github.com/graphql-rust/juniper/pull/1158#issuecomment-1502016225:
Integration of both protocols into a single crate showed, that fully separate crates (and therefore, types) introduce integration problems, which are resolved by reusing same types in both crates.
Following this, as we aim to support both protocols in our HTTP integration crates, both
juniper_graphql_transport_ws
andjuniper_graphql_ws
crates are always used and depend on each other, which makes a little sense to support them a separate crates.Solution
Instead, it's enough to keep only one
juniper_graphql_ws
crate, where support both protocols via additive Cargo features. This will simplify maintenance and usage costs, while allowing to reuse similar types naturally, giving the desired level of polymorphism for supporting both protocols at the same time.Checklist