Socket
Socket
Sign inDemoInstall

apollo-link-ws

Package Overview
Dependencies
18
Maintainers
3
Versions
38
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    apollo-link-ws

WebSocket transport layer for GraphQL


Version published
Weekly downloads
70K
decreased by-2.35%
Maintainers
3
Install size
855 kB
Created
Weekly downloads
 

Readme

Source

This link is particularly useful to use GraphQL Subscriptions, but it will also allow you to send GraphQL queries and mutations over WebSockets as well.

import { WebSocketLink } from "apollo-link-ws";
import { SubscriptionClient } from "subscriptions-transport-ws";

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

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

const link = new WebSocketLink(client);

Options

WS Link takes either a subscription client or an object with three options on it to customize the behavior of the link. Takes the following possible keys in the configuration object:

  • uri: a string endpoint to connect to
  • options: a set of options to pass to a new Subscription Client
  • webSocketImpl: a custom WebSocket implementation

By default, this link uses the subscriptions-transport-ws library for the transport.

FAQs

Last updated on 09 Apr 2020

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc