Trait glimesh::SubscriptionConn[][src]

pub trait SubscriptionConn {
    type Error;
    #[must_use]
    fn subscribe<'a, 'life0, 'async_trait, Q>(
        &'life0 self,
        variables: Q::Variables
    ) -> Pin<Box<dyn Future<Output = Result<BoxStream<'a, Q::ResponseData>, Self::Error>> + Send + 'async_trait>>
    where
        Q: GraphQLQuery,
        Q::Variables: Send + Sync,
        'a: 'async_trait,
        Q: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
; }

Connections that implement this support graphql subscriptions.

Associated Types

type Error[src]

Error type representing any errors that can occurr when subscribing

Loading content...

Required methods

#[must_use]
fn subscribe<'a, 'life0, 'async_trait, Q>(
    &'life0 self,
    variables: Q::Variables
) -> Pin<Box<dyn Future<Output = Result<BoxStream<'a, Q::ResponseData>, Self::Error>> + Send + 'async_trait>> where
    Q: GraphQLQuery,
    Q::Variables: Send + Sync,
    'a: 'async_trait,
    Q: 'async_trait,
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

Send a graphql subscription over this connection. The future will resolve when the subscription has been established, and then any messages will be sent on the returned stream

This subscription is resiliant against errors on the underlying connection, such that for example, if the websocket connection fails, when/if it succesfully reconnects, the subscriptions will be replayed on the new connection. This is currently unobservable, please open an issue if you need to be able to detect when this happens.

Errors

This function may error if there was a problem with the underlying connection such as a dns resolution error, or the websocket is disconnected, or if the api returned an error or the api response failed to decode.

Loading content...

Implementors

impl SubscriptionConn for Connection[src]

type Error = WebsocketConnectionError

Loading content...