Absinthe Socket Relay
npm install @absinthe/socket-relay> Absinthe Socket Relay
- Installation
- Using npm
- Using yarn
- Examples
- API
- createFetcher
- Parameters
- createSubscriber
- Parameters
- isSubscribed
- Parameters
- References
- License
$ npm install --save @absinthe/socket-relay
$ yarn add @absinthe/socket-relay
- relay-environment.js
``javascript
// @flow
import {createFetcher, createSubscriber} from "@absinthe-phoenix-socket-relay";
import {Environment, Network} from "relay-runtime";
import absintheSocket from "./absintheSocket";
export default new Environment({
network: Network.create(
createFetcher(absintheSocket),
createSubscriber(absintheSocket)
),
store: new Store(new RecordSource())
});
`
Creates a Fetcher (Relay FetchFunction) using the given AbsintheSocket
instance
#### Parameters
- absintheSocket AbsintheSocket onError
- function (error: Error): any
Returns FetchFunction
Creates a Subscriber (Relay SubscribeFunction) using the given AbsintheSocket
instance
#### Parameters
- absintheSocket AbsintheSocket onRecoverableError
- function (error: Error): any
Returns SubscribeFunction
Returns a promise that resolves to true in case subscription of givenfalse
disposable has started or to otherwise
#### Parameters
- disposable` Disposable
- Absinthe Socket
- Relay
- Environment
- NetworkLayer
- FetchFunction
- SubscribeFunction
MIT :copyright: Jumpn Limited.