@r26d/absinthe-apollo-socket-relay
v1.1.4
Published
Absinthe Socket Relay for React
Downloads
3
Maintainers
Readme
@r26d/absinthe-apollo-socket-relay
Absinthe Socket Relay for React
Installation
Using npm
$ npm install --save @r26d/absinthe-apollo-socket-relay
Using yarn
$ yarn add @r26d/absinthe-apollo-socket-relay
Examples
- relay-environment.js
// @flow
import {createFetcher, createSubscriber} from "@absinthe-phoenix-socket-relay";
import {Environment, Network} from "relay-runtime";
import * as AbsintheSocket from '@r26d/absinthe-apollo-socket'
export default new Environment({
network: Network.create(
createFetcher(absintheSocket),
createSubscriber(absintheSocket)
),
store: new Store(new RecordSource())
});
API
createFetcher
Creates a Fetcher (Relay FetchFunction) using the given AbsintheSocket instance
Parameters
absintheSocket
onError
createSubscriber
Creates a Subscriber (Relay SubscribeFunction) using the given AbsintheSocket instance
Parameters
absintheSocket
onRecoverableError
isSubscribed
Returns a promise that resolves to true
in case subscription of given
disposable has started or to false
otherwise
Parameters
disposable
References
License
MIT :copyright: r26D LLC