Add feature gate websocket
for async-graphql-tide.
This commit is contained in:
parent
243e1d323a
commit
d3e14ae613
|
@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
- Add support for `graphql-ws` pings. [#635](https://github.com/async-graphql/async-graphql/issues/635)
|
- Add support for `graphql-ws` pings. [#635](https://github.com/async-graphql/async-graphql/issues/635)
|
||||||
|
- Add feature gate `websocket` for async-graphql-tide. [#636](https://github.com/async-graphql/async-graphql/issues/636)
|
||||||
|
|
||||||
## [2.9.15] 2021-09-10
|
## [2.9.15] 2021-09-10
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,10 @@ repository = "https://github.com/async-graphql/async-graphql"
|
||||||
keywords = ["futures", "async", "graphql"]
|
keywords = ["futures", "async", "graphql"]
|
||||||
categories = ["network-programming", "asynchronous"]
|
categories = ["network-programming", "asynchronous"]
|
||||||
|
|
||||||
|
[features]
|
||||||
|
default = ["websocket"]
|
||||||
|
websocket = ["tide-websockets"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
async-graphql = { path = "../..", version = "=2.9.15" }
|
async-graphql = { path = "../..", version = "=2.9.15" }
|
||||||
async-trait = "0.1.48"
|
async-trait = "0.1.48"
|
||||||
|
@ -18,7 +22,7 @@ futures-util = "0.3.13"
|
||||||
serde_json = "1.0.64"
|
serde_json = "1.0.64"
|
||||||
|
|
||||||
tide = { version = "0.16.0", default-features = false, features = ["h1-server"] }
|
tide = { version = "0.16.0", default-features = false, features = ["h1-server"] }
|
||||||
tide-websockets = "0.3.0"
|
tide-websockets = { version = "0.4.0", optional = true }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
# Surf lacks multipart support
|
# Surf lacks multipart support
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#![allow(clippy::needless_doctest_main)]
|
#![allow(clippy::needless_doctest_main)]
|
||||||
#![forbid(unsafe_code)]
|
#![forbid(unsafe_code)]
|
||||||
|
|
||||||
|
#[cfg(feature = "websocket")]
|
||||||
mod subscription;
|
mod subscription;
|
||||||
|
|
||||||
use async_graphql::http::MultipartOptions;
|
use async_graphql::http::MultipartOptions;
|
||||||
|
@ -21,6 +22,7 @@ use tide::{
|
||||||
Body, Request, Response, StatusCode,
|
Body, Request, Response, StatusCode,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#[cfg(feature = "websocket")]
|
||||||
pub use subscription::Subscription;
|
pub use subscription::Subscription;
|
||||||
|
|
||||||
/// Create a new GraphQL endpoint with the schema.
|
/// Create a new GraphQL endpoint with the schema.
|
||||||
|
|
|
@ -9,6 +9,7 @@ use tide::{Endpoint, Request, Response};
|
||||||
use tide_websockets::Message;
|
use tide_websockets::Message;
|
||||||
|
|
||||||
/// GraphQL subscription endpoint.
|
/// GraphQL subscription endpoint.
|
||||||
|
#[cfg_attr(docsrs, doc(cfg(feature = "websocket")))]
|
||||||
pub struct Subscription<S> {
|
pub struct Subscription<S> {
|
||||||
inner: Pin<Box<dyn Endpoint<S>>>,
|
inner: Pin<Box<dyn Endpoint<S>>>,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user