Socket
Socket
Sign inDemoInstall

graphql-subscriptions-client

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphql-subscriptions-client

A simpler client for graphql subscriptions based on apollographql/subscriptions-transport-ws


Version published
Weekly downloads
13K
decreased by-24.17%
Maintainers
1
Weekly downloads
 
Created
Source

graphql-subscriptions-client

This is based directly on the client from subscriptions-transport-ws. It uses native websockets to communicate with a graphql server which is using 'graphql-ws' protocol. It plays nice with rollup, too.

Usage

If you have a apollo-server instance you can use this for subscriptions only, pass all requests over the websocket.

import { SubscriptionClient } from 'subscriptions-transport-ws';

const GRAPHQL_ENDPOINT = 'ws://localhost:3000/graphql';

const client = new SubscriptionClient(GRAPHQL_ENDPOINT, {
  reconnect: true,
});

const query = `subscription onNewItem {
        newItemCreated {
            id
        }
    }`

client.request({query})

Query must be string.

Keywords

FAQs

Package last updated on 12 Apr 2019

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc