You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to make a subscription with a MPSC channel by passing the channel's receiver in async_graphql's context data.
However, the ctx.data only provides reference to objects, how could I get the rx receiver directly?
Here's a small example:
use async_graphql::{self,Context,Subscription};use futures::{channel::mpsc::Receiver, stream::Stream};#[derive(Default)]pubstructSomeSubscription;#[Subscription]implSomeSubscription{asyncfnsomething(&self,ctx:&Context<'_>) -> implStream<Item = i32>{let rx = ctx.data::<Receiver<i32>>().unwrap();// rx is a &Receiver<i32>, what to do?!}}
Is there another way to do this?
Please let me know how should i go about that!
The text was updated successfully, but these errors were encountered:
Hello there,
I'm trying to make a subscription with a MPSC channel by passing the channel's receiver in
async_graphql
's context data.However, the
ctx.data
only provides reference to objects, how could I get the rx receiver directly?Here's a small example:
Is there another way to do this?
Please let me know how should i go about that!
The text was updated successfully, but these errors were encountered: