apollo-split-client
A simple TypeScript client implementation that enables Subscriptions alongside your Queries and Mutations when using Apollo's ApolloProvider.
Installation
# with npm
npm i apollo-split-client
# with yarn
yarn add apollo-split-client
Usage
apollo-split-client
is a package with a client
property that exposes a configured ApolloProvider client. apollo-split-client
accepts two arguments, an httpUri
which is the path for your Queries and Mutations, and an optional wsUri
which is the path for your WebSocket instance for Subscriptions.
You can use apollo-split-client
to easily use Subscriptions within React Apollo. Alternatively, you can omit the WebSocket location and use apollo-split-client
as an http only module.
React
// In App.js;;; // Enabled with Subscription Support through a WebSocketconst client = 'http://localhost:3000/graphql' 'ws://localhost:3000'; // Enabled as http-onlyconst client = 'http://localhost:3000/graphql'; // ... { return <ApolloProvider client=client> /* Query, Mutation, or Subscription Modules */ </ApolloProvider> } ;
Contributing
Interested in contributing? View the contribution guidelines here.