Registry / database / greycat-websocket

greycat-websocket

JSON →
library10.0.0jsnpmunverified

GreyCat WebSocket plugin enables remote read/write access to GreyCat graphs over WebSocket connections. Current stable version is 10.0.0. Provides a WSClient storage layer that integrates with GreyCat's GraphBuilder. Key differentiator: allows real-time graph interaction without local storage, enabling distributed applications. Releases are tied to GreyCat versioning; compatibility with major GreyCat versions is critical. Documentation is sparse; usage examples focus on initialization and basic CRUD operations.

npm install greycat-websocket
INSTALL
IMPORT
SIG · GREYCAT-WEBSOCKET
G
greycat-websocket
databasejavascriptv10.0.0
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.

WSClient
import { GraphBuilder } from 'greycat'; import { WSClient } from 'greycat-websocket';
var greycatWS = require('greycat-websocket'); var client = greycatWS.WSClient;
ESM-style imports are preferred. The WSClient is a named export, not a default one.
default import (whole module)
import greycatWS from 'greycat-websocket';
No default export; the module only exports named exports. Use named import instead.
CommonJS require
const { WSClient } = require('greycat-websocket');
const greycatWS = require('greycat-websocket'); greycatWS.WSClient;
Destructured require is cleaner and matches ESM style.

Connects to a WebSocket server, creates a node, sets a property, and saves.

import { GraphBuilder } from 'greycat'; import { WSClient } from 'greycat-websocket'; const graph = GraphBuilder.newBuilder() .withStorage(WSClient('ws://127.0.0.1:4000')) .build(); graph.connect(() => { const node = graph.newNode(0, 0); node.set('name', graph.type('STRING'), 'myFirstNode'); graph.save(null); });
Debug
Known issues
breakingVersion 10.x is a major overhaul; WSClient signature changed from object to direct string URL.
fix
Update WSClient call to pass WebSocket URL as string directly: WSClient('ws://...') instead of previous object-based config.
affects: >=10.0.0
gotchaThe graph must be connected before any operations; calling newNode or save before connect callback will fail silently or throw.
fix
Always perform graph operations inside the connect callback or after awaiting connection.
affects: >=1.0.0
gotchaType errors if using incorrect Type constants; use graph.type('STRING') or Type.STRING imported from 'greycat'.
fix
Ensure correct import of Type constants from 'greycat' package.
affects: >=1.0.0
deprecatedCallback pattern for graph.connect is deprecated; use Promise or async/await instead.
fix
Use async/await: await graph.connect();
affects: >=10.0.0
Errors
Common errors & fixes
TypeError: WSClient is not a constructor
Calling WSClient with 'new' or incorrect import method.
fix
Use WSClient as a function: WSClient('ws://...')
Or ensure named import: import { WSClient } from 'greycat-websocket';
Error: Cannot find module 'greycat'
Missing peer dependency 'greycat'.
fix
Install greycat: npm install greycat
TypeError: Cannot read properties of null (reading 'save')
Attempting to call graph.save before graph.connect callback has executed.
fix
Place graph.save inside the connect callback or use async/await.
Upgrade
Version history
10.0.0latest on npm
Audit
Dependencies
greycatrequiredCore graph library required for GraphBuilder, Type, and graph operations
Agent activity
25 hits · last 30 days
node
24
OpenAI (training)
1
Resources
greycat-websocket — npm install greycat-websocket · libregistry