The official Node.js SDK for EnSync - a high-performance message-driven integration engine.
- Website: ensync.cloud
- Documentation: docs.ensync.cloud
- GitHub: EnSync-engine/Node-SDK
1. ensync-client-sdk - gRPC Client
High-performance gRPC client for server-to-server communication.
npm install ensync-client-sdkUse when:
- Building server-to-server communication
- Need high performance and low latency
- Working in Node.js backend services
- Require HTTP/2 features
2. ensync-websocket-client - WebSocket Client
Real-time WebSocket client for bidirectional communication.
npm install ensync-websocket-clientUse when:
- Building browser applications
- Need bidirectional real-time communication
- Working with WebSocket infrastructure
- Require browser compatibility
3. ensync-utils - Shared Utilities
Shared utilities for encryption, error handling, and JSON validation.
npm install ensync-utilsIncludes:
- Error handling (EnSyncError)
- Ed25519 and hybrid encryption
- JSON validation and type checking
const { EnSyncEngine } = require("ensync-client-sdk");
const engine = new EnSyncEngine("grpcs://node.gms.ensync.cloud");
const client = await engine.createClient(appKey, {
appSecretKey: secretKey
});
await client.publish("orders/created", [recipientKey], {
orderId: "123",
amount: 99.99
});const { EnSyncEngine } = require("ensync-websocket-client");
const engine = new EnSyncEngine("wss://node.gms.ensync.cloud8443");
const client = await engine.createClient(appKey, {
appSecretKey: secretKey
});
const subscription = await client.subscribe("orders/created");
subscription.on((message) => {
console.log(message.payload);
});- Clone the repository
- Run the setup script:
./setup-local-dev.shThis will:
- Install dependencies for all packages
- Link packages locally using npm link
- Setup the tests directory
cd tests
node grpc-producer.js
node grpc-subscriber.js
node websocket-producer.js
node ws-subscriber.jsNote: Ensure your .env file in the tests directory has the correct credentials:
ENSYNC_ACCESS_KEY=your_app_key_here
CLIENT_ACCESS_KEY=your_app_key_here
APP_SECRET_KEY=your_secret_key_here
EVENT_TO_PUBLISH=your/event/name
RECEIVER_IDENTIFICATION_NUMBER=recipient_public_key_base64To publish all packages to npm:
./deploy-all.shThis script will:
- Check npm login status
- Publish
ensync-utilsfirst (required by other packages) - Wait for npm registry to update
- Publish
ensync-client-sdk(gRPC) - Publish
ensync-websocket-client
Prerequisites:
- Be logged in to npm:
npm login - Have publish permissions for the packages
- Update version numbers in package.json files before publishing
ensync-sdk-js/
├── packages/
│ ├── ensync-client-sdk/ # gRPC client package
│ │ ├── grpc.js
│ │ ├── ensync.proto
│ │ ├── package.json
│ │ ├── README.md
│ │ ├── CHANGELOG.md
│ │ └── API.md
│ │
│ ├── ensync-websocket-client/ # WebSocket client package
│ │ ├── websocket.js
│ │ ├── package.json
│ │ └── README.md
│ │
│ └── ensync-utils/ # Shared utilities package
│ ├── error.js
│ ├── ecc-crypto.js
│ ├── json-utils.js
│ ├── index.js
│ ├── package.json
│ └── README.md
│
├── tests/ # Shared test files
│ ├── grpc-producer.js
│ ├── grpc-subscriber.js
│ ├── websocket-producer.js
│ ├── ws-subscriber.js
│ └── .env
│
├── setup-local-dev.sh # Local development setup
├── deploy-all.sh # Deploy all packages to npm
├── PACKAGE_SEPARATION.md # Package separation guide
└── README.md # This file
- Terminology Update: Changed from event-based to message-driven terminology
- Authentication:
accessKey→appKey - JSON-Oriented: Added JSON validation and schema support
- Package Separation: Split into three separate npm packages
- Shared Utils: Created
ensync-utilsfor common functionality - Proto Updates: Updated
.protofile with message-driven naming
See CHANGELOG.md for detailed changes.
- gRPC Client README
- gRPC API Reference
- WebSocket Client README
- Utils README
- Package Separation Guide
- Changelog
- Website: ensync.cloud
- Documentation: docs.ensync.cloud
- npm Packages:
ISC
EnSync Team