# apollo-split-client

> A module that adds support for Subscriptions alongside Mutations and Queries for the ApolloProvider client. Open Sourced under MIT.

Latest version **1.1.1** (published 2019-03-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install apollo-split-client
pnpm add apollo-split-client
yarn add apollo-split-client
bun add apollo-split-client
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2019-03-01 |
| First published | 2018-08-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 7 |
| Unpacked size | 11.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | stevenisbell |
| Keywords | javascript, graphql, apollo, apollo-client, subscriptions, queries, mutations |

## Links

- npm: https://www.npmjs.com/package/apollo-split-client
- Repository: https://github.com/steven-isbell/apollo-split-client
- Homepage: https://github.com/steven-isbell/apollo-split-client#readme
- Issues: https://github.com/philipszdavido/mypluralize/issues
- npm.io page: https://npm.io/package/apollo-split-client

## Dependencies (7)

- [apollo-link](https://npm.io/package/apollo-link.md) ^1.2.2
- [apollo-link-ws](https://npm.io/package/apollo-link-ws.md) ^1.0.8
- [apollo-link-http](https://npm.io/package/apollo-link-http.md) ^1.5.4
- [apollo-utilities](https://npm.io/package/apollo-utilities.md) ^1.0.18
- [apollo-link-error](https://npm.io/package/apollo-link-error.md) ^1.1.0
- [apollo-cache-inmemory](https://npm.io/package/apollo-cache-inmemory.md) ^1.2.7
- [subscriptions-transport-ws](https://npm.io/package/subscriptions-transport-ws.md) ^0.9.14

## Alternatives

- [apollo-link-http-common](https://npm.io/package/apollo-link-http-common.md) — 879.0K weekly downloads
- [react-relay](https://npm.io/package/react-relay.md) — 336.8K weekly downloads
- [relay-test-utils](https://npm.io/package/relay-test-utils.md) — 181.6K weekly downloads
- [@vendure/core](https://npm.io/package/@vendure/core.md) — 14.8K weekly downloads
- [@pnpm/deps.graph-sequencer](https://npm.io/package/@pnpm/deps.graph-sequencer.md) — 13.4K weekly downloads

## Recent versions

- 1.1.1 (latest) — 2019-03-01
- 1.1.0 — 2019-03-01
- 1.0.9 — 2019-03-01
- 1.0.8 — 2018-09-25
- 1.0.7 — 2018-09-16
- 1.0.6 — 2018-09-05
- 1.0.5 — 2018-09-03
- 1.0.4 — 2018-08-30
- 1.0.3 — 2018-08-17
- 1.0.2 — 2018-08-17
- 1.0.1 — 2018-08-17

## README

# 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

```javascript
// In App.js
import React, { Component } from 'react';
import ApolloSplitClient from 'apollo-split-client';
import { ApolloProvider } from 'react-apollo';

// Enabled with Subscription Support through a WebSocket
const { client } = new ApolloSplitClient('http://localhost:3000/graphql', 'ws://localhost:3000');

// Enabled as http-only
const { client } = new ApolloSplitClient('http://localhost:3000/graphql');

class App extends Component {
    // ...
    render() {
        return (
            <ApolloProvider client={client}>
                {/* Query, Mutation, or Subscription Modules */}
            </ApolloProvider>
        )
    }
}

export default App;
```

# Contributing

Interested in contributing? View the contribution guidelines <a href="/CONTRIBUTING.md">here.</a>

---
_Source: https://npm.io/package/apollo-split-client · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
