Trait juniper::SubscriptionCoordinator[][src]

pub trait SubscriptionCoordinator<'a, CtxT, S> where
    S: ScalarValue
{ type Connection: SubscriptionConnection<S>; type Error; fn subscribe(
        &'a self,
        _: &'a GraphQLRequest<S>,
        _: &'a CtxT
    ) -> BoxFuture<'a, Result<Self::Connection, Self::Error>>; }

Global subscription coordinator trait.

With regular queries we could get away with not having some in-between layer, but for subscriptions it is needed, otherwise the integration crates can become really messy and cumbersome to maintain. Subscriptions are also quite a bit more stability sensitive than regular queries, they provide a great vector for DOS attacks and can bring down a server easily if not handled right.

This trait implementation might include the following features:

  • contains the schema
  • keeps track of subscription connections
  • handles subscription start, maintains a global subscription id
  • max subscription limits / concurrency limits
  • subscription de-duplication
  • reconnection on connection loss / buffering / re-synchronisation

'a is how long spawned connections live for.

Associated Types

type Connection: SubscriptionConnection<S>[src]

type Error[src]

Type of error while trying to spawn SubscriptionConnection

Loading content...

Required methods

fn subscribe(
    &'a self,
    _: &'a GraphQLRequest<S>,
    _: &'a CtxT
) -> BoxFuture<'a, Result<Self::Connection, Self::Error>>
[src]

Return SubscriptionConnection based on given GraphQLRequest

Loading content...

Implementors

Loading content...