Registry / communication / genesys-cloud-streaming-client

genesys-cloud-streaming-client

JSON →
library20.0.0jsnpmunverified

A JavaScript/TypeScript client library (v20.0.0) for interacting with Genesys Cloud Streaming APIs via WebSocket and XMPP. It provides real-time event subscriptions, conversation management, and presence features for Genesys Cloud platforms. The library is actively maintained and released regularly, with TypeScript definitions included. Compared to direct WebSocket libraries, it abstracts authentication, reconnection, and message serialization. Supports both CommonJS and ESM, and is designed for Node.js environments.

npm install genesys-cloud-streaming-client
INSTALL
IMPORT
SIG · GENESYS-CLOUD-STRE
G
genesys-cloud-streaming-client
communicationjavascriptv20.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.

StreamingClient
import { StreamingClient } from 'genesys-cloud-streaming-client'
const StreamingClient = require('genesys-cloud-streaming-client');
The library is ESM-only since v20; CommonJS require is not supported.
Types
import type { StreamingClientOptions } from 'genesys-cloud-streaming-client'
import { StreamingClientOptions } from 'genesys-cloud-streaming-client'
Type-only imports should use `import type` to avoid runtime side effects.
Events
import { StreamingClientEvent } from 'genesys-cloud-streaming-client'
Enum-like constants are exported as named values.

Initializes a streaming client, connects, and subscribes to a presence topic.

import { StreamingClient } from 'genesys-cloud-streaming-client'; const client = new StreamingClient({ environment: 'mypurecloud.com', accessToken: process.env.ACCESS_TOKEN ?? '', logLevel: 'info' }); client.on('connected', () => { console.log('Connected to Genesys Cloud Streaming'); }); client.connect(); // Subscribe to a topic client.subscribe('v2.users.me.presence', (event) => { console.log('Presence update:', event); });
Debug
Known issues
breakingIn v20, the constructor signature changed: `accessToken` is now required and `logLevel` replaced the old `debug` property.
fix
Update constructor call to use `accessToken` and `logLevel` options.
affects: >=20.0.0
breakingThe library dropped CommonJS support. `require()` will throw an error.
fix
Use ES module imports (`import`) instead of `require()`.
affects: >=20.0.0
deprecatedThe `onMessage` callback pattern is deprecated. Use event listeners with `client.on('message', ...)`.
fix
Replace `onMessage` handlers with `.on()` listeners.
affects: >=18.0.0
gotchaToken expiration is not handled automatically; the client will disconnect without reconnecting if the token expires.
fix
Implement a token refresh mechanism and call `client.setAccessToken(newToken)` before expiry.
affects: *
Errors
Common errors & fixes
Cannot find module 'genesys-cloud-streaming-client'
Missing npm install or incorrect import path.
fix
Run `npm install genesys-cloud-streaming-client@20` and ensure import uses named export.
TypeError: client.connect is not a function
Incorrect import; likely used default import instead of named.
fix
Use `import { StreamingClient } from 'genesys-cloud-streaming-client'`.
Error: Unable to authenticate; invalid access token
The accessToken provided to constructor is invalid or expired.
fix
Generate a new OAuth token and pass it in the constructor.
Upgrade
Version history
20.0.0latest on npm
Audit
Dependencies
genesys-cloud-streaming-clientrequiredPeer dependency for type definitions
Agent activity
20 hits · last 30 days
node
16
Amazon
1
OpenAI (training)
1
Resources
genesys-cloud-streaming-client — npm install genesys-cloud-streaming-client · libregistry