apollo-link-timeout-with-context
TypeScript icon, indicating that this package has built-in type declarations

1.1.8 • Public • Published

apollo-link-timeout

An Apollo Link that aborts requests that aren't completed within a specified timeout period. Note that timeouts are enforced for query and mutation operations only (not subscriptions).

Installation

npm install apollo-link-timeout

or

yarn add apollo-link-timeout

Usage

import ApolloLinkTimeout from 'apollo-link-timeout';
import { createHttpLink } from 'apollo-link-http';
import { ApolloClient } from 'apollo-client';

...

const timeoutLink = new ApolloLinkTimeout(10000); // 10 second timeout

const httpLink = createHttpLink({ uri: "/graphql" });

const timeoutHttpLink = timeoutLink.concat(httpLink);

const apolloClient = new ApolloClient({ link: timeoutHttpLink });

// use timeout-enabled Apollo client...

See Apollo documentation for information on using the Apollo client.

Package Sidebar

Install

npm i apollo-link-timeout-with-context

Weekly Downloads

1

Version

1.1.8

License

MIT

Unpacked Size

9.87 kB

Total Files

8

Last publish

Collaborators

  • mikaoelitiana