Solve problem #99

This commit is contained in:
sunli 2020-05-20 15:44:59 +08:00
parent e949cb441c
commit 87c6d31907
3 changed files with 5 additions and 5 deletions

View File

@ -15,7 +15,7 @@ const CLIENT_TIMEOUT: Duration = Duration::from_secs(10);
pub struct WSSubscription<Query, Mutation, Subscription> {
schema: Schema<Query, Mutation, Subscription>,
hb: Instant,
sink: Option<mpsc::Sender<Bytes>>,
sink: Option<mpsc::UnboundedSender<Bytes>>,
init_context_data: Option<Box<dyn Fn(serde_json::Value) -> FieldResult<Data> + Send + Sync>>,
}

View File

@ -338,7 +338,7 @@ where
&self,
transport: T,
) -> (
mpsc::Sender<Bytes>,
mpsc::UnboundedSender<Bytes>,
SubscriptionStream<Query, Mutation, Subscription, T>,
) {
create_connection(self.clone(), transport)

View File

@ -56,7 +56,7 @@ pub fn create_connection<Query, Mutation, Subscription, T: SubscriptionTransport
schema: Schema<Query, Mutation, Subscription>,
transport: T,
) -> (
mpsc::Sender<Bytes>,
mpsc::UnboundedSender<Bytes>,
SubscriptionStream<Query, Mutation, Subscription, T>,
)
where
@ -64,7 +64,7 @@ where
Mutation: ObjectType + Sync + Send + 'static,
Subscription: SubscriptionType + Sync + Send + 'static,
{
let (tx_bytes, rx_bytes) = mpsc::channel(8);
let (tx_bytes, rx_bytes) = mpsc::unbounded();
(
tx_bytes,
SubscriptionStream {
@ -94,7 +94,7 @@ pub struct SubscriptionStream<Query, Mutation, Subscription, T: SubscriptionTran
schema: Schema<Query, Mutation, Subscription>,
transport: T,
streams: SubscriptionStreams,
rx_bytes: mpsc::Receiver<Bytes>,
rx_bytes: mpsc::UnboundedReceiver<Bytes>,
handle_request_fut: Option<HandleRequestBoxFut<T>>,
waker: AtomicWaker,
}