Registry / messaging / ensync-client-sdk

ensync-client-sdk

JSON →
library0.2.2jsnpmunverified

EnSync gRPC Client SDK (v0.2.2) is a high-performance, message-driven communication library for Node.js, enabling server-to-server messaging via HTTP/2 and Protocol Buffers. It features end-to-end encryption (Ed25519/hybrid), JSON validation, message lifecycle management (publish, subscribe, acknowledge, defer, discard, replay), flow control, and auto-reconnection. Developed by EnSync, it targets real-time event-driven architectures and integrates with the EnSync engine. The package is actively maintained and ships TypeScript definitions.

messaging
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.

Named export only; no default import available. Use destructured import.

import { EnSyncEngine } from 'ensync-client-sdk'

EnSyncClient is the return type of createClient. Import as named export.

import { EnSyncClient } from 'ensync-client-sdk'

Message is the type for received messages; not 'Event'.

import { Message } from 'ensync-client-sdk'

Creates an EnSync client, publishes a message to 'orders/created', subscribes to the same topic, and acknowledges received messages.

const { EnSyncEngine } = require('ensync-client-sdk'); async function main() { const engine = new EnSyncEngine('grpcs://node.gms.ensync.cloud'); const client = await engine.createClient(process.env.APP_KEY ?? '', { appSecretKey: process.env.APP_SECRET ?? '' }); await client.publish( 'orders/created', ['recipient-key'], { orderId: '123', amount: 99.99 }, { persist: true } ); const subscription = await client.subscribe('orders/created'); subscription.on(async (message) => { console.log('Received:', message.payload); await subscription.ack(message.idem, message.block); }); } main().catch(console.error);
Debug
Known footguns
breakingConstructor now requires a URL with 'grpcs://' prefix (TLS) or 'grpc://' (plaintext); omitting prefix crashes.
gotchacreateClient() expects 'appSecretKey' inside an object, not a string; passing a string directly throws.
gotchasubscribe() returns a subscription object with an 'on' method; not a callback directly.
deprecatedThe 'ack' method now requires both 'idem' and 'block' parameters; single-argument ack is deprecated.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
17 hits · last 30 days
gptbot
3
bytedance
2
bingbot
1
ahrefsbot
1
Resources