@jumpn/absinthe-phoenix-socket-relay

0.1.1 • Public • Published

@jumpn/absinthe-phoenix-socket-relay

Absinthe Phoenix Socket Relay

Installation

Using npm

$ npm install --save @jumpn/absinthe-phoenix-socket-relay

Using yarn

$ yarn add @jumpn/absinthe-phoenix-socket-relay

Examples

  • relay-environment.js
// @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())
});

API

createFetcher

Creates a Fetcher (Relay FetchFunction) using the given AbsintheSocket instance

Parameters

  • absintheSocket AbsintheSocket
  • onError function (error: Error): any

Returns FetchFunction

createSubscriber

Creates a Subscriber (Relay SubscribeFunction) using the given AbsintheSocket instance

Parameters

  • absintheSocket AbsintheSocket
  • onRecoverableError function (error: Error): any

Returns SubscribeFunction

isSubscribed

Returns a promise that resolves to true in case subscription of given disposable has started or to false otherwise

Parameters

  • disposable Disposable

Returns Promise<boolean>

References

License

MIT ©️ Jumpn Limited / Mauro Titimoli (mauro@jumpn.com)

Package Sidebar

Install

npm i @jumpn/absinthe-phoenix-socket-relay

Weekly Downloads

5

Version

0.1.1

License

MIT

Last publish

Collaborators

  • tlvenn
  • mgtitimoli