1.0.3 • Published 5 years ago

zox-graphql-ws v1.0.3

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

Frontend WeSocket interface for Zox.js GraphQL endpoint

Connect using a single line of code.
WeSocket will auto-reconnect if connection breaks.

const gql = new GraphQLWebSocket();
const gql = new GraphQLWebSocket('ws://localhost:8080/graphql');

Subscribe to any number of event feeds.

var sid = gql.subscribe({id:'subscription-id'}, event => console.log(event));

Unsubscribe using the returned subscription id.

gql.unsubscribe(sid);

Execute Queries and Mutations over the same connection.

gql.query({id:'query-id'}, event => console.log(event));
const event = gql.queryAsync({id:'query-id'});

Options:

query: Send raw GraphQL Query
id: Execute a predefined Query by it's ID
op: Operation name - used when the Query contains multiple operations
vars: Variables
1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

6 years ago

1.0.0

6 years ago