• Subscribes to a graphql subscription

    Example

    This examples shows how to listen to changes in the groups of an organization

    import {Graphql, Group, OnNewGroupSubscription, Subscription,Subscriptions, OnNewGroupSubscriptionVariables} from '@tokens-studio/sdk';

    //Assumes we are already authed

    const filter : OnNewGroupSubscriptionVariables = { organization: 'urn:ts:....'};


    const subscription = Subscription.subscribe<Group>(Graphql.op(Subscriptions.OnNewGroupSubscription,filter),
    {
    next:({value})=>console.log(value)
    error:(err)=>console.error(err)
    })

    // At some point during cleanup
    subscription.unsubscribe();

    Returns

    Type Parameters

    • T

    Parameters

    Returns Subscription

Generated using TypeDoc