Registry / communication / graphql-io-client

graphql-io-client

JSON →
library1.8.4jsnpmunverified

A GraphQL network communication client framework for Node.js and browser environments (current version 1.8.4). It integrates GraphQL.js, Apollo Client, Axios, and a WebSocket interface to provide queries, mutations, and subscriptions. Compared to raw Apollo Client, it simplifies setup with a unified Client class and automatic transport selection (HTTP/WebSocket). Development appears slow with no recent updates; compatible with Node >=6.0.0. Differentiators include easy-to-use API and built-in WS support.

npm install graphql-io-client
INSTALL
IMPORT
SIG · GRAPHQL-IO-CLIENT
G
graphql-io-client
communicationjavascriptv1.8.4
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Client
import { Client } from 'graphql-io-client'
import Client from 'graphql-io-client'
The 'Client' is a named export, not default. Both ESM and CommonJS work.
Client (CJS)
const { Client } = require('graphql-io-client')
const Client = require('graphql-io-client')
CommonJS require destructures the named export.
TypeScript types
import type { ClientOptions, Client } from 'graphql-io-client'
import { ClientOptions } from 'graphql-io-client' using value import
TypeScript users should use 'import type' for types to avoid runtime overhead.

Shows how to import Client, connect, execute a simple GraphQL query, and disconnect.

const { Client } = require('graphql-io-client'); const client = new Client({ url: 'http://127.0.0.1:12345/api' }); (async () => { await client.connect(); const result = await client.query('{ hello }'); console.log(result.data); await client.disconnect(); })();
Debug
Known issues
gotchaThe Client constructor requires a 'url' option; omitting it will cause connection failure.
fix
Always provide a valid GraphQL endpoint URL: new Client({ url: '...' })
affects: >=1.0.0
gotchaThe connect() and disconnect() methods return Promises; forgetting to await them can lead to race conditions.
fix
Use async/await or .then() when calling connect() and disconnect().
affects: >=1.0.0
gotchaWhen using CommonJS require, destructure the named export; requiring the entire module yields an object with Client.
fix
Use const { Client } = require('graphql-io-client')
affects: >=1.0.0
deprecatedThe package relies on older Apollo Client (v2) and Axios; consider migrating to Apollo Client v3+ and native fetch for new projects.
fix
For new projects, consider using @apollo/client directly with its own transport.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Must provide document to query
The query argument to client.query() is missing or not a valid GraphQL string.
fix
Ensure you pass a non-empty string like '{ hello }'.
TypeError: client.connect is not a function
The import did not correctly get the Client class (likely default import instead of named).
fix
Use named import: import { Client } from 'graphql-io-client'
UnhandledPromiseRejectionWarning: Error: Network error: ...
The server URL is incorrect or server is unreachable.
fix
Check the url option passed to the Client constructor.
Upgrade
Version history
1.8.4latest on npm
Audit
Dependencies
graphqlrequiredCore GraphQL parsing/validation engine
@apollo/clientrequiredUnderlying Apollo Client for query execution
apollo-client-wsoptionalWebSocket transport for subscriptions
axiosrequiredHTTP client for queries and mutations
Agent activity
22 hits · last 30 days
node
18
Amazon
1
OpenAI (training)
1
Resources
graphql-io-client — npm install graphql-io-client · libregistry