5.0.0 • Published 4 months ago
apollo-link-timeout v5.0.0
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...
// Override timeout from any query
<Query
query={SOME_QUERY}
variables={{
someVar1: "foo",
someVar2: "bar",
}}
context={{ timeout: 3000 }}
>
// ...
See Apollo documentation for information on using the Apollo client.
5.0.0
4 months ago
4.0.0
4 years ago
3.0.0
5 years ago
2.0.1
5 years ago
1.4.1
5 years ago
1.4.0
6 years ago
1.3.1
6 years ago
1.3.0
6 years ago
1.2.1
6 years ago
1.2.0
6 years ago
1.1.10
6 years ago
1.1.9
7 years ago
1.1.8
7 years ago
1.1.7
7 years ago
1.1.6
7 years ago
1.1.5
7 years ago
1.1.4
7 years ago
1.1.3
7 years ago
1.1.2
7 years ago
1.1.1
7 years ago
1.1.0
7 years ago
1.0.1
7 years ago
1.0.0
7 years ago