This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

@gocorus/socket-apollo-link

0.2.7 • Public • Published

@gocorus/socket-apollo-link > Absinthe Socket Apollo Link

Installation ### Using npm ``` $ npm

install --save @gocorus/socket-apollo-link ### Using [yarn](https://yarnpkg.com) $ yarn add @gocorus/socket-apollo-link ## Examples 1. Create AbsintheSocketLink (`absinthe-socket-link.js`)javascript // @flow import * as AbsintheSocket from "@gocorus/socket"; import {createAbsintheSocketLink} from "@gocorus/socket-apollo-link"; import {Socket as PhoenixSocket} from "phoenix"; export default createAbsintheSocketLink(AbsintheSocket.create( new PhoenixSocket("ws://localhost:4000/socket") )); 2. Send all the operations using AbsintheSocketLinkjavascript // @flow import ApolloClient from "apollo-client"; import {InMemoryCache} from "apollo-cache-inmemory"; // see example 1 import absintheSocketLink from "./absinthe-socket-link"; const client = new ApolloClient({ link: absintheSocketLink, cache: new InMemoryCache() });

HttpLink ```javascript // @flow import ApolloClient from "apollo-client"; import
{createHttpLink} from "apollo-link-http"; import {hasSubscription} from
"@jumpn/utils-graphql"; import {InMemoryCache} from "apollo-cache-inmemory";
import {split} from "apollo-link"; // see example 1 import absintheSocketLink
from "./absinthe-socket-link"; const link = split( operation =>
hasSubscription(operation.query), absintheSocketLink, createHttpLink({uri:
"/graphql"}) ); const client = new ApolloClient({ link, cache: new
InMemoryCache() }); ``` ## API ## References - [Absinthe Phoenix
Socket](https://github.com/absinthe-graphql/absinthe-socket/tree/master/packages/socket)
- **Apollo Link** - [Apollo
Client](http://apollo-link-docs.netlify.com/docs/link/#apollo-client) -
[Terminating
Links](http://apollo-link-docs.netlify.com/docs/link/overview.html#terminating)
- [Directional
Composition](http://apollo-link-docs.netlify.com/docs/link/composition.html#directional)
- [Http Link](http://apollo-link-docs.netlify.com/docs/link/links/http.html) ##
License [MIT](LICENSE.txt) :copyright: Jumpn Limited.

Dependencies (8)

Dev Dependencies (1)

Package Sidebar

Install

npm i @gocorus/socket-apollo-link

Weekly Downloads

2

Version

0.2.7

License

MIT

Unpacked Size

1.88 MB

Total Files

23

Last publish

Collaborators

  • corus-dev