This package has been deprecated

Author message:

Please use graphql-ws client instead

benzene-ws-client
TypeScript icon, indicating that this package has built-in type declarations

0.0.1 • Public • Published

benzene-ws-client

Super ligt

This package is only experimental and not tested.

Only works with @benzene/ws for now.

Install

yarn add benzene-ws-client

Usage

import { SubscriptionClient } from 'benzene-ws-client';

const subscriptionClient = new SubscriptionClient('wss://localhost/graphql', options);

urql

import { Client, defaultExchanges, subscriptionExchange } from 'urql';

const client = new Client({
  url: '/graphql',
  exchanges: [
    ...defaultExchanges,
    subscriptionExchange({
      forwardSubscription(operation) {
        return subscriptionClient.request(operation);
      },
    }),
  ],
});

@apollo/client

import { WebSocketLink } from "@apollo/client/link/ws";

const link = new WebSocketLink(subscriptionClient);

Options

option description default
reconnectionAttempts Number of attempts to try reconnect on disconnection. Set to 0 to disable 0 (disabled)
genId A function to generate unique subscription ids. Default to incremental ids. undefined

Readme

Keywords

none

Package Sidebar

Install

npm i benzene-ws-client

Weekly Downloads

2

Version

0.0.1

License

MIT

Unpacked Size

12 kB

Total Files

13

Last publish

Collaborators

  • hoangvvo