Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

graphql-apollo-client

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphql-apollo-client

Helpful utility that will make your development process faster. This can be used in any library. Basically nodejs based.

  • 1.0.7
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

graphql-apollo-client

Helpful utility that will make your development process faster. This can be used in any library. Basically nodejs based.

Install Package

npm install graphql-apollo-client --save 

or

yarn add graphql-apollo-client

Example

import { configureClient } from 'graphql-apollo-client';

const client = configureClient({
  httpEndpoint: '<HTTP_GRAPHQL_URL>', 
  wsEndpoint: '<WS_GRAPHQL_URL>', 
  bearerToken: 'Bearer <TOKEN>'
})
`

The above code is to configure client. Now it's time to use this client Note: To define query you need import gql from graphql-apollo-client

import { gql } from 'graphql-apollo-client';


const query = gql`
  query Books {
    books {
      title
      author
    }
  }
`

const subscription = gql`
  subscription {
    realtimeMeasurement(deviceId: "pM8SEyRQ") {
      activePowerImport
      time
    }
  }
`

client
  .query({
    query: query,
    variables: {},
  })
  .then(console.log)

client
 .subscribe({
   query: subscription,
   variables: {}
 })
 .subscribe({
   next(data) {
     console.log(data);
   }
 });

Keywords

FAQs

Package last updated on 16 Sep 2022

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