Socket
Book a DemoInstallSign in
Socket

benzene-ws-client

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

benzene-ws-client

Tiny WebSocket client for GraphQL over WebSocket Protocol

latest
npmnpm
Version
0.0.1
Version published
Maintainers
1
Created
Source

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

optiondescriptiondefault
reconnectionAttemptsNumber of attempts to try reconnect on disconnection. Set to 0 to disable0 (disabled)
genIdA function to generate unique subscription ids. Default to incremental ids.undefined

FAQs

Package last updated on 06 Sep 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts