WIP subscription support, will require switching webserver
This commit is contained in:
@@ -2,10 +2,11 @@ use std::{fmt, str::FromStr};
|
||||
|
||||
use async_graphql::{
|
||||
connection::{self, Connection, Edge, OpaqueCursor},
|
||||
Context, EmptySubscription, Enum, Error, FieldResult, InputObject, Object, Schema,
|
||||
SimpleObject, Union,
|
||||
futures_util::{Stream, StreamExt},
|
||||
Context, Enum, Error, FieldResult, InputObject, Object, Schema, SimpleObject, Union,
|
||||
};
|
||||
use cacher::FilesystemCacher;
|
||||
use futures::stream;
|
||||
use letterbox_notmuch::Notmuch;
|
||||
use log::info;
|
||||
use serde::{Deserialize, Serialize};
|
||||
@@ -667,4 +668,12 @@ impl Mutation {
|
||||
}
|
||||
}
|
||||
|
||||
pub type GraphqlSchema = Schema<QueryRoot, Mutation, EmptySubscription>;
|
||||
pub struct Subscription;
|
||||
#[async_graphql::Subscription]
|
||||
impl Subscription {
|
||||
async fn values(&self, ctx: &Context<'_>) -> Result<impl Stream<Item = usize>, Error> {
|
||||
Ok(stream::iter(0..10))
|
||||
}
|
||||
}
|
||||
|
||||
pub type GraphqlSchema = Schema<QueryRoot, Mutation, Subscription>;
|
||||
|
||||
Reference in New Issue
Block a user